Search code examples
pythonopencvfeature-detection

OpenCV - After feature points detection, how can I get the x,y-coordinates of the feature points


My process is

  • first is to detect the feature points
  • next, I want the x,y-coordinates of feature points in order to build a histogram to find the local density of maxima of x,y histogram

Any helps is appreciate

Following this example: http://docs.opencv.org/3.0-beta/doc/py_tutorials/py_feature2d/py_orb/py_orb.html#orb


Solution

  • In

    kp = orb.detect(img,None)
    kp, des = orb.compute(img, kp)
    

    The kp variable is a list of Keypoint objects.

    The pt member of this object is the position of the keypoint.

    So, for example:

    for i,keypoint in enumerate(kp):
        print "Keypoint %d: %s" % (i, keypoint.pt)