Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

Resampling small images / Why is image zooming different from resampling?

So, lets assume somewhere my software generate images with 1*3px size. When I use Image Resample, it generates images that are, obviously, not working in terms of proportions. While not pretty, this is not unexpected behaviour because of lack of interpolation points. 

 

resample.PNG

 

I do need scaled up images. What I can do, is to blow up the image to a resolution that is a multiple of the 3px size, and then rescale it again. However, this does not only lose me processing time (and memory management time), it's also quite a hassle. For example, next task is to take a 4*1 image and rescale it to 199*50..., same ugly effect, same solution.

 

resamplevsdisplay.PNG

(Obviously, this is an example reduced to the core problem itself, but my real tasks involves resampling very small image segments to resolutions that are not-previously known)

 

The image display seems to solve this task automatically .. somehow. Is there any way I can utilize this functionality (except for automatically screenshotting?) 

 

Thanks a lot,

Birgit

 

(attached a sample program where I test exactly this behaviour. I understand why it happens... I can fix it with a bit of modulo and testing which rescaling gives good performance.. I just have some tiny hope that there is a hidden gem somewhere in the library that gives me what is obviously already implemented).

0 Kudos
Message 1 of 2
(4,288 Views)

Hello,

I'd say the biggest issue here is that if you are resampling upwards and your original image has 3 px width that might cause an error of about 33,33...% in the resampled image if you are not resampling with factor that is not multiple of the original img size. I modified little bit you example so you can test it out. Just enable/disable "Enable Pixel Mapping Coercion?" while changing "Desired Resample factor"

 

BTW: I assume LV image display changes the size (zoom) in steps that are multiple of least common multiple of the image size...

 

Ondřej K.

NIEE AE

CLA, CTA, CLED
0 Kudos
Message 2 of 2
(4,232 Views)