当我尝试执行以下操作时:
cv2.drawMatches(img1, keypoints1, img2, keypoints2, matches, None, matchColor=(0,255,0), singlePointColor=(0, 0, 255))
我得到这个错误:
error: OpenCV(4.1.0) ../modules/features2d/src/draw.cpp:127: error: (-2:Unspecified error) in function 'void cv::_prepareImage(cv::InputArray, const cv::Mat&)' Unsupported source image: 'src.type() == CV_8UC1 || src.type() == CV_8UC3 || src.type() == CV_8UC4' where 'src.type()' is 21 (CV_32FC3)
昨天没有发生这个错误,我也没有更新环境或图片。如何修复此错误?不知道如何正确转换。你知道吗
我可以看到错误发生在here,但不确定需要什么源类型。你知道吗
函数\u prepareImage似乎接受CV\u 8UC1这种类型是8U:Unsigned int 8位,C1:1通道。但是,似乎您正在发送一个32F,32位,有3个通道。你知道吗
验证您拥有的图像的类型并相应地分配它。你知道吗
我只需将图像类型转换如下:
cv2.drawMatches(np.uint8(img1), keypoints1, np.uint8(img2), keypoints2, matches, None, matchColor=(0,255,0), singlePointColor=(0, 0, 255))
相关问题 更多 >
编程相关推荐