[英]Extracting pixel values from keypoints generated by ORB in OpenCV Python
我已經使用OpenCV在圖像中找到要點,這些要點以矢量形式存儲在名為kp
的變量中。 用於此的代碼:
#Read image and convert to greyscale
img = cv2.imread(DIR + i,0)
#Resize image to 100 x 100
r_g_img = cv2.resize(img, (100,100))
#Feature extraction
orb = cv2.ORB_create(scaleFactor=2, edgeThreshold=0)
kp = orb.detect(r_g_img,None)
kp,des = orb.compute(r_g_img,kp)
現在,當我查看kp
和des
的存儲值時,會看到以下內容:
>>> kp
[<KeyPoint 05DA9318>, <KeyPoint 02F7A0C0>, <KeyPoint 02F7A098>, <KeyPoint 02F7ABB0>,...
>>> des
array([[ 89, 4, 163, ..., 14, 116, 98],
[ 17, 93, 81, ..., 184, 112, 173],
[184, 85, 50, ..., 63, 52, 67],
...,
[ 3, 216, 229, ..., 29, 88, 220],
[163, 29, 71, ..., 124, 124, 86],
[102, 92, 166, ..., 126, 244, 124]], dtype=uint8)
我並不完全確定des
到底指的是什么,但是我所追求的是關鍵點的像素位置(x,y)。 當我在調試器監視窗口中拉出kp
時(見下圖),我看到的像素值列為pt
。 我可以使用什么代碼來獲取這些值?
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.