image transformations

☆樱花仙子☆ 提交于 2019-12-24 00:34:17

问题


So I've been using gnu-gsl and CImg to implement some of the fundamental projective space techniques for affine and metric rectification.

I've completed computing an affine rectification but, I'm having a hard time figuring out how to apply the affine rectification matrix to the original (input) image.

My current thought process is to iterate across the input image for each pixel coordinate. Then multiply the original pixel coordinate (converted to a homogeneous coordinate) by the affine rectification matrix to get the output pixel coordinate.

Then access the output image using the output pixel coordinate and conduct a blend (addition) operation on the output image's pixel location with the pixel color from the original image.

Does that sound right? I'm getting a lot of really weird values after multiplying the original pixel coordinate by the affine rectification matrix.


回答1:


No, your values should not be weird. Why don't you make a simple example, a small scale with a small translation; e.g.

x' = 1.01*x + 0.0*y + 5;
y' = 0.0*x + 0.98*y + 10;

Now the pixel at (10,10) should map to (15.1,19.8), right ?

If you want to make a nice output image, you should find the forward projection and then back project to the input image and interpolate there rather than try to blend into the output image. Otherwise you will end up with gaps in the output.

You need to be careful with your terminology here; it sounds to me like you are doing projections, sometimes called warping in the computer graphics community. Rectification is something else, but it depends on what you are doing.



来源:https://stackoverflow.com/questions/5264430/image-transformations

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!