OPENCV SIFT-关键点检测对象的质心?
我试图在我的项目的OpenCV筛选的帮助下找到圆形形状的质心。
找到质心后,尝试安装编码环以检测标记类型。 SIFT算法是我项目的最佳选择,因为它是标量和旋转不变的。它似乎可以检测到对象的质心关键,我正在尝试获得其坐标。
import cv2
import numpy as np
def findSift(img, gray, draw=True):
sift = cv2.SIFT_create(10)
kp = sift.detect(gray, None)
if draw:
cv2.drawKeypoints(img, kp, img)
kp_coordinates = cv2.KeyPoint_convert(kp)
return kp_coordinates
if __name__ == "__main__":
img = cv2.imread('Test.jpg')
print(img.shape[:2])
gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
Array_Cooridinates = findSift(img,gray)
cv2.imshow('img',img)
cv2.waitKey(0)
Image Resolution: (849, 734)
Array of coordinates of keypoints detected:
[[346.20126 385.5532 ]
[366.1102 217.0911 ]
[366.1102 217.0911 ]
[482.2291 451.484 ]
[482.2291 451.484 ]
[468.70483 303.86118]
[468.70483 303.86118]
[385.93945 296.0943 ]
[417.37436 445.36234]
[441.80768 377.35934]]
如果有人提到我的问题,请随时发布它,以便我可以对此进行更多研究。
感谢这里的任何帮助! 祝你今天过得愉快。
I am trying to find centroid of circular shape with the help of OpenCV Sift for my project.
After finding centroid try to fit a encoding ring to detect type of marker. The SIFT algorithm is the best for my project, since it is scalar and rotation invariant. It seems to detect the keypoint of centroid of object and i am trying to get the coordinates of it.
import cv2
import numpy as np
def findSift(img, gray, draw=True):
sift = cv2.SIFT_create(10)
kp = sift.detect(gray, None)
if draw:
cv2.drawKeypoints(img, kp, img)
kp_coordinates = cv2.KeyPoint_convert(kp)
return kp_coordinates
if __name__ == "__main__":
img = cv2.imread('Test.jpg')
print(img.shape[:2])
gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
Array_Cooridinates = findSift(img,gray)
cv2.imshow('img',img)
cv2.waitKey(0)
Image Resolution: (849, 734)
Array of coordinates of keypoints detected:
[[346.20126 385.5532 ]
[366.1102 217.0911 ]
[366.1102 217.0911 ]
[482.2291 451.484 ]
[482.2291 451.484 ]
[468.70483 303.86118]
[468.70483 303.86118]
[385.93945 296.0943 ]
[417.37436 445.36234]
[441.80768 377.35934]]
If someone have any reference to my problem, feel free to post it so i can do more research about it.
Thanks for any help here!
Have a nice day.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论