help-octave
[Top][All Lists]

## Re: imresize and ImageJ

 From: James Sherman Jr. Subject: Re: imresize and ImageJ Date: Tue, 19 Aug 2014 20:56:14 -0400

On Tue, Aug 19, 2014 at 8:28 PM, ijourneaux wrote:
I am surprised that the std dev could go up significantly when down sampling
by a integer factor. Perhaps I am just not understanding the goal of
imresize and interp2. I would have expected the desired output for each
pixel to be the best estimate of the new pixel location. It would seem to me
that this should almost always result in the std dev dropping.

Ian

--
View this message in context: http://octave.1599824.n4.nabble.com/imresize-and-ImageJ-tp4666125p4666133.html
Sent from the Octave - General mailing list archive at Nabble.com.

_______________________________________________
Help-octave mailing list
https://lists.gnu.org/mailman/listinfo/help-octave

Eventually, as you interpolate more and more, the std would be expected to go down because you're essentially smoothing out the data more and more, but there is certainly no guarantee in the interim.  Its the same reason that if you have n numbers and then select every 3rd number there's nothing to guarantee that the standard deviation is the same.

As far as the purpose of imresize and interp2, you're right it is to get the best estimate of the pixel value at that position, but this has no direct relation to standard deviation.  This occurs the same in the 1-D case.  Say that your original image is 10 "pixels" long, located at the the integer locations 0 through 9 with just some random values:
position: 0 1 2 3 4 5 6 7 8 9
value: 5 5 7 8 9 2 4 3 3 2

Now, if you wanted to resize your image to only have 4 pixels, one way (using interpolation) is that imagine that the "true" image is still exists from 0 to 9, but since you only have 4 pixels, the pixels are now at the positions 0, 3, 6, and 9 (equally spaced between 0 and 9) .  So now, how do you fill in those pixels?  Well, the best estimates for the values at positions 0, 3, 6 and 9?  Since these values are already "known" from the original image, the best values are just those original values.   On the other hand, if you wanted to resize down to only 3 pixels, you'd want to estimate the positions at 0, 4.5 and 9.  Well again, 0 and 9 are already "known" from the original image, but 4.5 is not, so thus one must have a way to interpolate using close by pixels.  The specific value is determined by the choice of interpolating function.

This does have drawbacks (particularly when downsizing), and one way to avoid some artifacts is to run the image through a lowpass filter (such as an averaging filter such as Stillwater described) before doing the resizing.  This in essence tries to calculate the average or "best" value representing a region of the original image, and not just at a particular point.

Hope this helps.