并排对齐两个图像 [英] Align two images side by side

查看:90
本文介绍了并排对齐两个图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个图像(几千个),让我们称它们为图像A和图像B.我知道它们要么并排,AB或BA,但我怎么能用c#代码验证这个?



一些图像,当并排放置时,会匹配。线条将对齐,圈子和其他一切也将对齐。有些根本不匹配。我想要一个数值近似值来确定它们的匹配程度。如果左图像的右列上的一个像素是红色,并且在同一行上,红色位于右图像的第一列中,则它们匹配。同样测试蓝色和绿色。由于可能存在变化,我会考虑匹配的概率。然后我可以在视觉上检查最近的那些。



我试图将左图像的最后一列的颜色与右图像的第一列进行比较,但我得到的价值没有显着差异。我希望一侧的红色值减去另一侧的红色值可能为零,绿色和蓝色相同。这样做并没有那么好。



有什么想法吗?我试过搜索结果,但似乎没有人试过这个。



也许这会有所帮助。拍摄10,000像素乘10,000像素的任何图像,并将其切成100个1000 x 1000像素的较小图像。什么是检查是否有任何图像(比方说B)属于另一个图像的一侧的最佳方法,让我们说A?不涉及图像的任何形式的旋转,并且知道A<>。 B,我们如何计算B在原始图像中A的右侧或顶部,底部或左侧的几率?

解决方案

我会认为是正确的左图像的边框和右图像的左边框(边框的宽度由您决定)。对于每个边框中的每个像素,您可以测试相邻像素并建立一些属性。我希望这些属性不会突然从一个边界转移到另一个边界。我知道这有点模糊,但我现在还没有更精确的想法。


我开始通过逐行比较两边的ARGB值来开始。我发现匹配的边和没有边的边之间没有足够的差异。



我现在正考虑采用红色差异的ABS值,绿色和蓝色,看看是否有帮助。经过这些努力,我可以计算每个像素的平均值和它旁边的像素,并对另一个图像做同样的事情。然后比较这些值...



我希望有人可能之前已经这样做了。我尝试在线搜索它,但我尝试使用的任何词汇都没有(相关)匹配。关于比较两张图片的大量信息,如果它们有匹配的边,则不是。



我会继续在这里查看,如果我发现任何相关信息,我会报告。感谢。

I have two images (of a few thousand), lets call them image A and image B. I know that they either go side by side, AB or BA, but how can I verify this using c# code?

Some of the images, when put side by side, will match up. Lines will align, so will circles and everything else. Some will not match at all. I would like a numerical approximation as to how well they do or do not match. If one pixel on the right column of the left image is red, and on the same row a red is in the first column of the right image, then they match. Same test for Blue and Green. Since there might be variations, I would settle for a probability of matching. I could then visually exam the closer ones first.

I have tried to compare the colors, of the last column of the left image with the first column of the right image, but there is no significant difference in the values that I get. I was hoping that the red value on one side less the red value on the other might zero out, and the same with the green and the blue. This did not work out that well.

Any ideas? I have tried searching for a result, but no one seems to have tried this.

Maybe this will help. Take any image 10,000 pixels by 10,000 pixels, and slice it into 100 smaller images 1000 x 1000 pixels. What is the best way to check if any image, lets say B, belongs on one side of another image, lets say A? Without involving any form of rotation of the images, and knowing that A <> B, how do we calculate the chance that B is on A's right side, or top, bottom or left side in the original image?

解决方案

I would consider the right border of the left image and the left border of the right one (the width of the borders is up to you). for each pixel in each border you may test the neighbour pixels and establish some properties. i would expect such properties don't change abruptly passing from one border to the other one. I know it is a bit vague, but I haven't a more precise idea, at the moment.


I started off by comparing the values of ARGB between the two sides, row by row. I found that there is not enough differences between the sides that match and the ones that don't.

I am now considering taking the ABS values of the differences in Red, Green and Blue and see if that helps. Past that effort, I might compute the average of each pixel and the pixels next to it and do the same to the other image. Then compare these values...

I was hoping that someone might have done this before. I tried searching for it online, but any vocabulary I tried using came back with no (relevant) matches. Lots of information on comparing two images, just not if they have matching sides.

I'll keep checking here, and I will report if I find anything relevant. Thanks.


这篇关于并排对齐两个图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆