Menu

#158 Confusing WarpAffine2dC

open
nobody
None
5
2003-04-22
2003-04-22
No

I don't think it is a big bug, but I noticed that
inside the implementation of method Apply,
there is a midpixel correction (shift of -0.5 pixel).
If the coordinate of the upper left corner of the first
pixel in the image is (-0.5,-0.5) then when using this
class for resizing the image -> i.e.
(-0.5,-0.5) of output maps onto (-0.5,-0.5) of input,
it implies that the translation vector should be
(scalefactor*0.5-0.5,scalefactor*0.5-0.5).
Without knowing of this midpixel correction (i.e. the
coordinates are actually internally shifted for -0.5)
the resulting shift is bigger and incorrect. It would
be good to:
1/ either add this to the documentation - i.e. properly
explain the coordinate systems of input and output
image and mention it

2/ which seems clearer, to avoid this midpixel
correction and leave it up to the programmer to include
this in the shift vector.

Regards,
Mirek

Discussion