LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Scaling a JPEG with ZoomFactor Property

Doh! Reply timeout Smiley Happy

So the original image was this:



Then I scaled it to 50% using various methods shown below.  The top left is LabVIEW, top right is MS Paint, Middle left is the GIMP with linear interpolation, middle right is The GIMP with no interpolation, bottom left is the GIMP with cubic interpolation.  As you can see, the only area with noticeable change is the circular pattern.  It seems that LabVIEW does as good a job as MS Paint, which obviously isn't a robust image manipulation program.  For now I think that the scaling is fine, if anyone thinks otherwise, don't hesitate to post with examples or comparisons or to leave product suggestions on the website.


Doug M
Applications Engineer
National Instruments
For those unfamiliar with NBC's The Office, my icon is NOT a picture of me 🙂
0 Kudos
Message 21 of 31
(1,532 Views)
Doug,

Thanks for looking into this. I recently wrote a slideshow VI in LV 8.20. Running on Mac OS, the IMAQ stuff is not available, so I did everything in LV. Zoom to both larger and smaller sizes seems to work fine with the scaletest.jpg and hermosa images. For the size of my Picture indicators the zoom factors were 1.39477 and 0.371389 from scaletest.jpg. The reduced image has a lot of moire on the circles, but is still reasonable decent. The enlarged image is quite good.

Lynn
0 Kudos
Message 22 of 31
(1,522 Views)
Doug M wrote:
>It seems that LabVIEW does as good a job as MS Paint, which obviously isn't a robust image manipulation program.
 
With the price we pay for LabVIEW, and IMAQ, we expect the quality comparible to Photoshop, not MS Paint ! 😉
 
And it's easy for C++, see what I get

Message Edited by zou on 02-28-2007 10:13 AM

George Zou
0 Kudos
Message 23 of 31
(1,517 Views)
I think we need to balance quality and speed. Somebody might want to display images in quick succession and IF LabVIEW cannot keep up because of scaling issues, people will start complaining even more.
 
Sure we all can look at the different algorithms with a magnifying glass, but so far we have NOT looked at the performance impact of a marginally better scaling algorithm. If your LabVIEW program needs to display 10000x10000 images at 20% scale, I am sure the various methods will show a significang difference in speed. Maybe somebody with access to all methods could do a benchmark.
 
Ideally, we would like to have a choice in algorithm (optimize for speed, optimize for quality, compromise), so the programmer can decide what is more important for the current situation. Another possibility would be an incremental display: show a quickly scaled image immediately, then, if the image sticks around and there is plenty of idle CPU, improve the quality in the background and redraw a little later (see e.g. Picasa).
 
The following image shows three algorithms used by Corel photopaint.
  1. Resampled at 50% with antialiasing.
  2. Resampled at 50% without antialiasing
  3. scaled at 50% in the work area, taken by a screenshot.

As you can see (3) is a compromise for performance reasons. A good reason! 🙂

Message Edited by altenbach on 02-28-2007 09:14 AM

0 Kudos
Message 24 of 31
(1,516 Views)

All -- thanks for running the tests! I'll be upgrading to 8.2 and, it seems like my needs will be met by the native scaling algorithm. Regarding additional algorithms that trade speed for results, my 2cents is that if Labview wants to get serious about image processing, then, additional algorithms should be available to the user as options. Labview is perfectly suited for this through the property node. Some applications will require speed, others will require performance -- let the user decide.

The resize function in irfanview (the freeware image processing program I use) allows the user to select if they want a resize or a resample, and for the resample option: it has 6 available resampling filters available. (see enclosed photo).

Thanks again to everyone!

-Ted

 

0 Kudos
Message 25 of 31
(1,494 Views)
Thanks everyone for your comments.  As I study these images, I have become convinced that image scaling is very difficult.  All of the resized images show quality loss -- and those that use anti-aliasing or interpolation have serious detail loss -- look how much smaller the main circle pattern is, also the smaller boxes of diagonal lines in some cases lose their pattern completely when using these algorithms.  It seems that which algorithm is best then is subjective.

My main concern was that from comments it sounded like there may be a bug in LabVIEW, and there was with the colors, which was fixed in 8.2, but the current scaling algorithm seems to be ok as a one size fits all choice.

What I would suggest is that if there is a specific algorithm that would help in your specific use case, that you make a product suggestion specific to this algorithm and provide screenshots and/or benchmarks with an explanation of how the algorithm is better for that case.  From all the screenshots posted from our test image, it seems you could make a case that any of them are the best depending on what part of the image you are trying to highlight.
Doug M
Applications Engineer
National Instruments
For those unfamiliar with NBC's The Office, my icon is NOT a picture of me 🙂
0 Kudos
Message 26 of 31
(1,488 Views)
Just an FYI: I upgraded to 8.20, and the zoom scaling now works well enough to meet my needs. That bug is now gone. Interestingly, if you just paste a picture on the front panel and try to resize it via the handles (not a control -- just a picture), the old bug is still there when you scale down. Not a major deal for me since the mode I'll be using the picture in now works.
 
Thanks
-Ted
0 Kudos
Message 27 of 31
(1,470 Views)
Hi Ted,

I'm glad you were able to upgrade.  I'm not able to reproduce the behavior you are describing -- could you post a screenshot of what you are referring to along with the original image?
Doug M
Applications Engineer
National Instruments
For those unfamiliar with NBC's The Office, my icon is NOT a picture of me 🙂
0 Kudos
Message 28 of 31
(1,468 Views)
Odd.. here's the sequence of events.
  1. Open a photo in an image viewer outside of labview
  2. Copy the photo to the clipboard
  3. Paste the image onto the front panel of a vi
  4. Scale the image holding the shift key down (to maintain aspect ratio)
  5. See the image get munched.

However, if I save the vi with the munched image, and then reopen it -- everything is fine.

-Ted

Download All
0 Kudos
Message 29 of 31
(1,461 Views)
  1. Just right-click on the full-size test picture above, "right-click..copy" in explorer.
  2. paste in empty front panel. (as decoration, NO image indicator, etc.)
  3. grab handle in one corner and resize. (half-size is even uglier!)

(I copied it twice and scaled the top one for that "before&after" effect :))

Here's the 8.20 result:

 

Message Edited by altenbach on 02-28-2007 03:52 PM

Message Edited by altenbach on 02-28-2007 03:53 PM

0 Kudos
Message 30 of 31
(1,465 Views)