简体   繁体   English

如何根据另一个重新定位一个二进制图像? opencv-python

[英]how to reposition one binary image based on another? opencv-python

I have images like these:我有这样的图像: 在此处输入图片说明

在此处输入图片说明

And I want to reposition one based on the other position, could be in a way where the number of white pixels intersection is as big as possible.我想根据另一个位置重新定位一个,可能是白色像素交叉点的数量尽可能大。 is that even possible?这甚至可能吗?

Assuming the two images are of the same object:假设两张图片是同一个对象:

Let us call the top image Image A, and let us call the bottom image Image B. If these two images were taken of the same object, we could define a transformation from image A to B using a projective transformation.让我们称顶部图像为图像 A,让我们称底部图像为图像 B。如果这两张图像取自同一个对象,我们可以使用投影变换定义从图像 A 到 B 的变换。 This would be a 3x3 matrix on the lefthand side multiplied by the coordinates of image A (x,y) on the right hand side.这将是左侧的 3x3 矩阵乘以右侧图像 A (x,y) 的坐标。

What you need to do is find the transformation A that makes A*ImageA = Image B您需要做的是找到使 A*ImageA = Image B 的变换 A

You can find more information on affine and projective transformations here: https://www.graphicsmill.com/docs/gm5/Transformations.htm您可以在此处找到有关仿射变换和投影变换的更多信息: https : //www.graphicsmill.com/docs/gm5/Transformations.htm

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM