2014-05-20 09:04:12 -0600 | received badge | ● Scholar (source) |
2014-05-20 09:04:05 -0600 | commented answer | cv2.warpAffine() results in an image shifted by 0.5 pixel OK, it's clear now. In cv2.warpAffine(), pixel values are considered located at grid cross-points (which is more mathematically consistent), not at the centers of grid squares (visually consistent). I was confused with cv2.resize() whose behaviour is more like the latter. |
2014-05-17 03:07:31 -0600 | received badge | ● Editor (source) |
2014-05-17 02:59:56 -0600 | asked a question | cv2.warpAffine() results in an image shifted by 0.5 pixel Warping an image with cv2.warpAffine() results in an image shifted by 0.5 pixel. Is this behaviour expected? If so, what's the reasons behind? CodeBelow is a simple example where an image is scaled with affine transform. Input 2x2 image: Output-1 (scaled up by a factor of 8): Output-2 (scaled down back to the original): WorkaroundWhen I rewrite the
: Output-1 (scaled up by a factor of 8): Output-2 (scaled down back to the original): |