問題描述
我正在使用帶有 CV_TM_CCORR_NORMED
的匹配模板的方法來比較兩個圖像......我想讓這個旋轉和縮放不變......有什么想法嗎?
I'm using the method of match template with CV_TM_CCORR_NORMED
to compare two images ... I want to make to make this rotation and scale invariant .. any ideas?
圖像和模板的傅里葉變換我嘗試用同樣的方法,但是旋轉后的結果還是不一樣
I tried to use the same method on the fourier transform of the image and the template , but still the result after rotation is different
推薦答案
在場景中旋轉或縮放對象時,使用 matchTemplate
的模板匹配效果不佳.
Template matching with matchTemplate
is not good when your object is rotated or scaled in scene.
您應該嘗試 Features2D
框架中的 openCV 函數.例如SIFT
或SURF
描述符,以及FLANN
匹配器.此外,您還需要 findHomography
方法.
You should try openCV function from Features2D
Framework. For example SIFT
or SURF
descriptors, and FLANN
matcher. Also, you will need findHomography
method.
這里是在場景中找到旋轉對象的一個??很好的例子.
Here is a good example of finding rotated object in scene.
更新:
簡而言之,算法是這樣的:
In short, algorithm is this:
尋找對象圖像的關鍵點1.1.從這些關鍵點中提取描述符
Finding keypoints of your object image 1.1. Extracting descriptors from those keypoints
尋找場景圖像的關鍵點2.1 從關鍵點中提取描述符
Finding keypoints of your scene image 2.1 Extracting descriptors from keypoints
通過匹配器匹配描述符
分析你的匹配
有不同類別的 FeatureDetector、DescriptorExtractors 和 DescriptorMatches,您可以閱讀它們并選擇適合您的任務的那些.
There are different classes of FeatureDetectors, DescriptorExtractors, and DescriptorMatches, you may read about them and choose those, that fit good for your tasks.
- openCV FeatureDetector(上述算法中的第 1 步和第 2 步)
- openCV DescriptorExtractor(算法中的步驟 1.1 和 2.1上面)
- openCV DescriptorMatcher(上述算法中的第 3 步)
- openCV FeatureDetector (steps 1 and 2 in algorithm above)
- openCV DescriptorExtractor ( steps 1.1 and 2.1 in algorithm above )
- openCV DescriptorMatcher ( step 3 in algorithm above )
這篇關于縮放和旋轉模板匹配的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!