The control points used for the resize (center of edge pixel, to center of new edge pixel) was only one aspect of the command that is under discussion. (Repeated here)
Code: Select all
convert \( xc:red xc:blue +append \) \
\( xc:yellow xc:cyan +append \) -append \
-filter point -interpolate bilinear -define distort:viewport=100x100 \
-distort Affine '.5,.5 .5,.5 1.5,1.5 99.5,99.5' interpolate_bilinear.jpg
Note that the scaling is NOT 2 pixels to 100 pixel (x50) but 1 pixel scaled to 99 pixels (x99)
ASIDE: the affine projection matrix is
-distort AffineProjection '99 0 0 99 -49 -49'
The other key aspect of the above is the use of a view port to actually trim the excess pixels from the result.
If you did not have that viewport you would still get a image that is essentially 198 pixels wide (plus a little bit for virtual pixel blending). That is to say the viewport is just as important as the scaling.
Because of this you can not just scale the image and get a correct 'edge pixel center resize'.
That actual example in this case is purely returning the area between the pixels. I needed to do the resize in this way as it was this area between pixels that was the important focus in that example. That is the interpolation that is being performed between the pixels when the lookup is a floating point value. It is NOT however what users expect to see when they simply resize images, as they focus on whole pixels, and not the interpolated area.
Now in a actual image resize you would not be using a simple bilinear interpolation, but something that would have a much larger area of influence. In any such larger convolution neighbourhood, you will naturally get virtual pixel effects, as the virtual pixels are less that one pixel away. Even with bi-cubic interpolation (16 neighbours, and a support distance of 2.0) will involve virtual pixel effects in the results, for than and any other 'resize using pixel centers'.
As such you will still need to either set appropriate virtual pixel setting or remove the influence of virtual pixel using the VP transparency technique on the results (see previous topic on creating a distort resize)
viewtopic.php?p=68362#p68362
I hope in IMv7 we will have a switch to completely remove virtual pixel effect from the results, in specific cases. that is remov its effect not only from color channels but the transparency channel too.
I do not see
-distort Resize being modified to allow for this type of 'pixel center' resize, though it is quite possible for it to be implemented.
If it is implemented I would prefer to use a special operational name for it (does it have a formal name in the scientific litrature) and have BOTH a orthogonal (tensor) and cylindrical variant implemented.
ASIDE: all interpolations are direct orthogonal filter styles of interpolation. However it is quite possible that some 2D radial interpolators could be added. Not that anyone has ever requested them. I would like to see the hermite filter added as a interpolator