【发布时间】:2016-06-27 08:59:10
【问题描述】:
我一直在尝试使用 ORB 来查找关键点/描述符,并且我需要屏蔽部分图像,因为我的图像的两个部分中的许多特征非常相似。但是,我无法确定检测和计算函数的掩码参数的正确格式,并且文档对我来说模棱两可。我尝试查看源代码,但我对 C++ 不够熟悉,无法理解它。我认为这只是一个二进制数组,其中 1 = 使用和 0 = 忽略,但我尝试过的每个掩码都不会返回任何关键点。下面是一些示例代码:
img1_gray = cv2.cvtColor(img1, cv2.COLOR_BGR2GRAY)
img2_gray = cv2.cvtColor(img2, cv2.COLOR_BGR2GRAY)
#ignore the left half of the first image
mask1 = np.ones(img1_gray.shape)
mask1[:,:mask1.shape[1]/2] = 0
#ignore the right half of the second image
mask2 = np.ones(img2_gray.shape)
mask2[:,mask2.shape[1]/2:] = 0
kp1, des1 =orb.detectAndCompute(img1_gray,mask1)
kp2, des2 =orb.detectAndCompute(img2_gray,mask2)
文档在这里:http://docs.opencv.org/3.0-beta/modules/features2d/doc/feature_detection_and_description.html
【问题讨论】:
-
如果你包含一些代码和一些图像可能会更好..