OPENCV SIFT-关键点检测对象的质心?

发布于 2025-02-12 05:59:33 字数 1231 浏览 0 评论 0原文

我试图在我的项目的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.

Test Image

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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文