图像变换
因此,我一直在使用 gnu-gsl 和 CImg 来实现一些用于仿射和度量校正的基本射影空间技术。
我已经完成了仿射校正的计算,但是,我很难弄清楚如何将仿射校正矩阵应用于原始(输入)图像。
我当前的思维过程是迭代输入图像的每个像素坐标。然后将原始像素坐标(转换为齐次坐标)乘以仿射校正矩阵即可得到输出像素坐标。
然后使用输出像素坐标访问输出图像,并使用原始图像中的像素颜色对输出图像的像素位置进行混合(相加)操作。
听起来对吗?将原始像素坐标乘以仿射校正矩阵后,我得到了很多非常奇怪的值。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不,你的价值观不应该很奇怪。为什么不做一个简单的例子,小规模小翻译;例如
,现在 (10,10) 处的像素应该映射到 (15.1,19.8),对吧?
如果你想制作一个漂亮的输出图像,你应该找到正向投影,然后反向投影到输入图像并在那里进行插值,而不是尝试混合到输出图像中。否则你最终会在输出中出现间隙。
你需要小心这里的术语;在我看来,您正在做投影,有时在计算机图形社区中称为扭曲。整改是另一回事,但这取决于你在做什么。
No, your values should not be weird. Why don't you make a simple example, a small scale with a small translation; e.g.
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.