Question

I'm trying to find the coordinates of all the shapes that HarrisCorner method marked on my image.

I have it set up so it's marking the correct corners and showing the correct results, but I can't figure out where to find the coordinates after all is said and done. I need a list of all of the corners that are marked by this algorithm so I can find their area, center of gravity, shape, & size. Separately I have a list of all of the pixels contained within each shape, so it would be easy for me to match the coordinates with the corresponding shape. I'm sorry if this is a green question. I've been reading everything I can find. Thank you OpenCV pros!

    im = cv.LoadImage("image.jpg")
    imgray = cv.LoadImage("image.jpg", cv.CV_LOAD_IMAGE_GRAYSCALE)

    cornerMap = cv.CreateMat(im.height, im.width, cv.CV_32FC1)
    cv.CornerHarris(imgray,cornerMap,3)
    for y in range(0,imgray.height):
       for x in range (0, imgray.width):
          harris = cv.Get2D(cornerMap, y, x)
          if harris[0] >10e-06:
              temp = cv.Circle(im, (x,y),2,cv.RGB(115,0,25))

    cv.ShowImage('my window', im)
    cv.SaveImage("newimage3.jpg",im)
    cv.WaitKey()
Was it helpful?

Solution

The corners are the (x,y) coordinates for which your corner-ness test passes:

if harris[0] > 10e-06
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top