设置Python / OpenCV中默认绘图功能的线宽

时间:2018-07-29 08:43:58

标签: python opencv

我想在两张不同的图片上绘制SIFT特征匹配项,但是当图像分辨率太高时,线条几乎变得不可见(当然,这通常是需要的,这是预期的行为,并且始终可以缩放,但是...)。有没有办法更改默认线宽(或通过作为标志),还是实现自定义绘图功能的唯一方法?

绘图示例代码:

img1 = np.array(Image.open("im1.jpg"))
img2 = np.array(Image.open("im2.jpg"))

sift = cv2.xfeatures2d.SIFT_create()
kp1, desc1 = sift.detectAndCompute(img1, None)
kp2, desc2 = sift.detectAndCompute(img2, None)

bf = cv2.BFMatcher(cv2.NORM_L2, crossCheck=True)

# Match descriptors.
matches = bf.match(desc1,desc2)

# Sort them in the order of their distance.
matches = sorted(matches, key = lambda x: x.distance)

out = np.concatenate([img1, img2], axis=1)
# Draw first 10 matches.
cv2.drawMatches(img1, kp1, img2, kp2, matches[:20], flags=2, outImg=out)

plt.figure(figsize=(18,14))
plt.imshow(out)
plt.show()

enter image description here

0 个答案:

没有答案