[Bug集合]OpenCV Error: Assertion failed ((type == CV_8U && dtype == CV_32S) || dtype == CV_32F)

转自:https://blog.csdn.net/qq_33591712/article/details/83050019

在做视觉里程计时,之间套用高博slam14讲的方法时报错:
OpenCV Error: Assertion failed ((type == CV_8U && dtype == CV_32S) || dtype == CV_32F) in batchDistance
原因:Since SIFT and SURF return a detectorType() of CV32F (=float) you cannot use any Hamming-distance as matcher. Hamming-distance works only for binary feature-types like ORB, FREAK, … I guess it would be possible if you’d convert them to CV8U. Afaik for SIFT this should be fairly easy since they are actually already normalized for the range 0-255 (double check that before you do it). However, I doubt that this is useful at all, use L2 norm for those and you should be fine.
orb描述子深度是CV_8U,可以用汉明距离的,而sift,surf,为CV32F直接套用汉明匹配则报错。

使用特征提取过程得到的特征描述符(descriptor)数据类型有的是float类型的,比如说SurfDescriptorExtractor,SiftDescriptorExtractor,有的是uchar类型的,比如说有ORB,BriefDescriptorExtractor。

对应float类型的匹配方式有:FlannBasedMatcher,BruteForce<L2>,BruteForce<SL2>,BruteForce<L1>。

对应uchar类型的匹配方式有:BruteForce,BruteForce。所以ORB和BRIEF特征描述子只能使用BruteForce匹配法。
 

猜你喜欢

转载自blog.csdn.net/unlimitedai/article/details/88795425