Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

Resizing images

Hello!

 

I've been looking around the forum for image resizing functions that don't suck, i.e. shrinking that uses proper anti-aliasing and expanding that uses bicubic interpolation. I couldn't find anything and have now written my own functions (vanilla LabVIEW only) that do this.

Now I wonder how interesting this is to the rest of you, and whether I've missed some smart solution somewhere.

 

Lars Melander
Uppsala Database Laboratory, Uppsala University
0 Kudos
Message 1 of 4
(4,076 Views)

As long as you have a decent filter generator, these wouldn't be too difficult.  Reduction would require a smoothing filter followed by the IMAQ Extract.  Expansion would require IMAQ Expand followed by a smoothing filter.  The size of the filter would depend on the ratio of the before and after sizes.  It might be more efficient to use a 1xN filter followed by a Nx1 filter.

 

If you have put these all together, it think it would be worthwhile posting them.

 

Bruce

Bruce Ammons
Ammons Engineering
0 Kudos
Message 2 of 4
(4,060 Views)

Now I've downloaded the Vision evaluation. The IMAQ Resample function is quite interesting. But how does the image control work? It's just a control, not an xcontrol, so how can it be responsive like an xcontrol? Obviously, there's LabVIEW functionality that I've missed, and a pointer to info would be much appreciated.

 

I've included my own function for shrinking an image. It's much slower of course, mainly because of the matrix multiplications. But the result is better than the IMAQ resample function, and much better for zooms below 0.5 (I've never understood why one would use interpolation for shrinking an image).

 

shrink.png

 

Lars Melander
Uppsala Database Laboratory, Uppsala University
Message 3 of 4
(4,044 Views)

Here's the expand function. It's very slow, but I don't think you can beat the simplicity (included functions notwithstanding). It also seems to be doing a very slightly better work than the IMAQ resample function.

 

expand.png

 

Lars Melander
Uppsala Database Laboratory, Uppsala University
Message 4 of 4
(4,042 Views)