Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

in chapter 3 the hough-line #5

Open
yqtaowhu opened this issue Dec 7, 2016 · 3 comments
Open

in chapter 3 the hough-line #5

yqtaowhu opened this issue Dec 7, 2016 · 3 comments

Comments

@yqtaowhu
Copy link

yqtaowhu commented Dec 7, 2016

this is some wrong with me,i run you code ,but this is not right for you example,have no line int the picture,
i do not know what is wrong
please tell me ,thank you very much!

@techfort
Copy link
Owner

techfort commented Dec 7, 2016

hey @yqtaowhu can you elaborate a bit? what appears to be wrong, and in what file?

@yqtaowhu
Copy link
Author

yqtaowhu commented Dec 8, 2016

@techfort i very happy you can reply me , in the chaper3 ,and Hough_Lines.py to detect a line
`import cv2
import numpy as np

img = cv2.imread('lines.jpg')
gray = cv2.cvtColor(img,cv2.COLOR_BGR2GRAY)
edges = cv2.Canny(gray,50,120)
minLineLength = 20
maxLineGap = 0
lines = cv2.HoughLinesP(edges,1,np.pi/180,50,minLineLength,maxLineGap)
dst = edges
for x1,y1,x2,y2 in lines[0]:
cv2.line(edges,(x1,y1),(x2,y2),(255,0,0),2)

cv2.imshow("edges", edges)
cv2.imshow("lines",img)
cv2.waitKey()
cv2.destroyAllWindows()`
and the result not show a line detect , it is only the origin picture , i dont know why,i have not change your code .
Look forward to your reply

@Micah2015
Copy link

I changed lines[0] to follows
for line in lines:
for x1,y1,x2,y2 in line:
cv2.line(img,(x1,y1),(x2,y2),(0,255,0),5)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants