[英]Opencv4Android,stitching two images
I have to stitch two images and I use openCV4Android
.I read docs and some threads in about stitching images,for example: Panorama – Image Stitching in OpenCV , Homography between images using OpenCV for Android , Stitch multiple images , Error matching with ORB in Android and others.At first,it seems easy.But the result is strange!Below,you can see two images that I used for test and result: 我必须缝合两个图像,然后使用
openCV4Android
。我阅读了有关缝合图像的文档和一些主题,例如: Panorama – OpenCV中的图像缝合, 使用OpenCV for Android的图像之间的同形 , 缝合多个图像 , Android中与ORB的错误匹配起初看起来很简单。但是结果很奇怪!下面,您可以看到两个用于测试和结果的图像:
Here is "image1": 这是“ image1”:
This is "image2": 这是“ image2”:
You can see drawed features: 您可以看到绘制的特征:
And this is result of warping image1
: 这是
image1
扭曲的结果:
What I did wrong?Or it may be I did not understand good? 我做错了什么?或者可能是我听不懂?
I would say that you don't have enough overlap between your images. 我会说您的图像之间没有足够的重叠。 If you look at your matches (what you call "drawed features"), most of them are wrong.
如果您查看匹配项(您将其称为“绘制特征”),则大多数错误。 As a first test, try to stitch two images that have, say, 80% overlap.
作为第一个测试,请尝试拼接两个具有80%重叠的图像。
When you stitch two images, you assume that there exists an affine transform (your "homography") that will project features from one image onto the other one. 拼接两个图像时,假定存在一个仿射变换(您的“单应性”),可以将要素从一个图像投影到另一个图像上。 When you know this transform, then you know the relative position of your images and you can "put them together".
当您知道此变换后,便知道图像的相对位置,可以将它们“放在一起”。 If the homography transform that you find is bad, then the stitching will be bad as well.
如果您发现的单应变换不正确,那么缝合也将不正确。
FeatureDetector
) on both images. FeatureDetector
检测两个图像上的特征。 DescriptorExtractor
). DescriptorExtractor
描述它们。 Basically this creates a representation of your features, so that you can compare two features and see how similar they are. DescriptorMatcher
) features from the first image to the features from the second image. DescriptorMatcher
)将第一张图像中的特征与第二张图像中的特征进行匹配。 It means that for each feature in the first image, you try to find the most similar one in the second image. If you look at your "drawed features", you will see that only a few ones on the "Go" part of "Google" and some in the boorkmarks correspond, when the others are wrong. 如果您查看“绘制的功能”,您会看到“ Google”的“执行”部分中只有少数几个与布洛克标记中的一些相对应,而其他则有误。 It means that most of your matches are bad, and then it makes it possible to find a homography that works for this data, but that is wrong.
这意味着您的大多数匹配都不正确,然后可以找到适用于此数据的单应性,但这是错误的。
In order to have a better homography, you would need much more "good" matches. 为了获得更好的单应性,您将需要更多的“好”匹配。 Consequently, you probably need to have more overlap between your images.
因此,您可能需要在图像之间有更多的重叠。
NOTE: try your code with the images used in " Panorama – Image Stitching in OpenCV " 注意:尝试将代码与“ 全景– OpenCV中的图像拼接 ”中使用的图像一起使用
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.