矩形模板匹配

大佬,模板匹配时当匹配图像角度很小接近0°时特征点非常少,如上图,模板制作时也是同样情况.
最少点数设的多少?
num_features:200
代码用的最新的吗?同样的图像,不是0度模板就正常了?
代码用的最新的,是的,当模板有角度时特征点很多,如下图:

有意思。可以把原图跟复现代码给出来吗?
代码用的test.cpp:noise_test,模板原图如下:

直接在master branch上试了下,把detector num features 30改成200,0度也正常呀。
直接在master branch上试了下,把detector num features 30改成200,0度也正常呀。 特征点少是因为num features设置的少吗?
找到问题了,我设置模板角度是-20~20度,只用求一次特征点,其余角度旋转特征点就行.
if (info.scale != scale) {
templ_id = detector.addTemplate(shapes.src_of(info), class_id, shapes.mask_of(info), num_features * info.scale);
first_id = templ_id;
first_angle = info.angle;
scale = info.scale;
} else {
templ_id = detector.addTemplate_rotate(class_id, first_id,
info.angle - first_angle,
{shapes.src.cols / 2.0f, shapes.src.rows / 2.0f});
}
还有个问题,demo的识别结果特征点是很准确的分布在边缘,但矩形框位置有偏差,大佬,是我方式不对吗?
int x = templ[0].width + match_x;
int y = templ[0].height + match_y;
cv::rectangle(test_img, {match.x, match.y}, {x, y}, randColor, 2);

这个框看上去挺好的呀,就是大了一圈
对呀,大了,我想提取边缘中心,这咋整,是我画的方式不对吗?特征点位置很准确,矩形框会大一些.
可以调用cv::minAreaRect
直接在master branch上试了下,把detector num features 30改成200,0度也正常呀。 特征点少是因为num features设置的少吗?
你好 我在master branch测试angle_test, 没有很好的匹配上,知道是什么原因吗
@DaxiongAI @mo704507064 可以參考下我寫的NCC-Based模板匹配,角度精度測試與Cognex-Pat Quick差不多 https://github.com/DennisLiu1993/Fastest_Image_Pattern_Matching