python-2.7 - 复杂图像中的角点检测

标签 python-2.7 opencv computer-vision opencv-contour corner-detection

enter image description here

我想在上面的图片中找到一个固定点,以便以后进行比较,我想到了木板的左上角。我尝试了一些操作,但结果显示为绿色点。我想找到一种方法可以将那个点放在板子的一角而不是上方。我还想使这一点在同一块板的一组图片中相同,但可能会有一些变化。我正在使用python 2.7

到目前为止我尝试过的代码:

gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
blurred = cv2.GaussianBlur(gray, (3, 3), 0)
edged = cv2.Canny(blurred, 10, 200)
edged = cv2.dilate(edged, None, iterations=6)
edged = cv2.erode(edged, None, iterations=6)
(contourss, _) = cv2.findContours(edged.copy(), cv2.RETR_EXTERNAL,
                        cv2.CHAIN_APPROX_SIMPLE)
contourss = sorted(contourss, key=cv2.contourArea, reverse=True)[:10]
cv2.drawContours(image, contourss[0], -1, (0, 255, 0), 2)

rect1 = cv2.minAreaRect(contourss[0])
box1 = cv2.cv.BoxPoints(rect1)
box1 = np.int0(box1)
topleftPer=[]
for i in box1[1]:
    topleftPer.append(i)
pt = (topleftPer[0], topleftPer[1])
cv2.circle(image, pt, 5, (0, 255, 0), -1)

最佳答案

看到人们想要如何依靠边缘检测总是令人惊讶。边缘检测是如此不可靠!

该图像易于二值化。查找具有x + y最小值的黑色像素,并在该像素周围放置一个小的ROI。然后使用最左边和最上面的坐标。

enter image description here

关于python-2.7 - 复杂图像中的角点检测,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47041302/

相关文章:

image - 提高图像质量以通过 OpenCV 读取模糊数字

python - 如何在 OpenCV Python 中检测红色?

python - 如何在opencv python中检测和删除框架形式的边框?

python - 如何安装 Python 3.6 和 Python 2.7?

python - 程序行为的解释(Python)

python - 我的第一个自述文件在 pypi.python.org 上未格式化

python - int'对象没有属性 '__getitem__'

python - 如何更改 kivy 中 BoxLayout 的顺序?

c++ - 有没有办法在保持图像引用的同时从两个图像创建一个垫子

c - 在经典代码 opencv c++ 中使用池化层