小编Jan*_*ney的帖子

OpenCV houghLinesP参数

我使用HoughLinesP和Python中的OpenCV在这个图像中找到棋盘上的线很困难.

为了理解HoughLinesP的参数,我提出了以下代码:

import numpy as np
import cv2
from matplotlib import pyplot as plt
from matplotlib import image as image

I = image.imread('chess.jpg') 
G = cv2.cvtColor(I, cv2.COLOR_BGR2GRAY)

# Canny Edge Detection:
Threshold1 = 150;
Threshold2 = 350;
FilterSize = 5
E = cv2.Canny(G, Threshold1, Threshold2, FilterSize)

Rres = 1
Thetares = 1*np.pi/180
Threshold = 1
minLineLength = 1
maxLineGap = 100
lines = cv2.HoughLinesP(E,Rres,Thetares,Threshold,minLineLength,maxLineGap)
N = lines.shape[0]
for i in range(N):
    x1 = lines[i][0][0]
    y1 = lines[i][0][1]    
    x2 = lines[i][0][2] …
Run Code Online (Sandbox Code Playgroud)

python opencv houghlinesp

18
推荐指数
2
解决办法
2万
查看次数

标签 统计

houghlinesp ×1

opencv ×1

python ×1