在OpenCV中为python找到用CornerHarris方法标记的角落的坐标 [英] Find the coordinates of the Corners marked with CornerHarris method in OpenCV for python

查看:1167
本文介绍了在OpenCV中为python找到用CornerHarris方法标记的角落的坐标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图找到HarrisCorner方法在我的图像上标记的所有形状的坐标。

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

我设置了它,所以它标记正确的角落并显示正确的结果,但我不知道在哪里找到所有的坐标后说完成。
我需要一个由这个算法标记的所有角落的列表,所以我可以找到他们的区域,重心,形状&尺寸。
另外,我有一个包含在每个形状内的所有像素的列表,所以我很容易匹配坐标与相应的形状。
对不起,如果这是一个绿色问题。我一直在阅读我能找到的一切。谢谢OpenCV专业!

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()


推荐答案

角落是您的角落测试通过的(x,y)坐标:

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

if harris[0] > 10e-06

这篇关于在OpenCV中为python找到用CornerHarris方法标记的角落的坐标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆