问题描述
我需要有关掩码参数的帮助,以将关键点检测应用于特定的感兴趣区域。如何在 np.array 中定义具有 x/y 范围的区域?
import numpy as np
import cv2 as cv
img = cv.imread('test_img.jpg')
gray = cv.cvtColor(img,cv.COLOR_BGR2GRAY)
gray2 = np.float32(gray)
print(img.shape)
max_corners = 20
quality_level = 8 / 100
min_distance = 7
###################?????????????################
mask = ???
# how to define the mask with specific x/y pixel coordinates?
corners = cv.goodFeaturesToTrack(gray2,max_corners,quality_level,min_distance,mask)
#print(corners)
corners = np.int0(corners)
for i in corners:
x,y = i.ravel()
cv.circle(img,(x,y),2,(0,255,0),-1)
cv.imshow('Detection Test',img)
cv.waitKey(0)
cv.destroyAllWindows()
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)