I am trying to run a code on lane detection using opencv library in python. But I am getting a numpy.ndarray
error:
TypeError: 'numpy.ndarray' object is not callable
File "lane_detect.py", line 10, in <module>
line(img,(x1,y1),(x2,y2),(0,255,0),2)
Here is the code I am trying to run:
from cv2 import *
from numpy import *
from matplotlib import pyplot as plt
img = imread("Lane1.png", 0)
edges = Canny(img,100,200)
lines = HoughLinesP(edges,1,pi/180,100,minLineLength=100,maxLineGap=10)
for line in lines:
x1,y1,x2,y2 = line[0]
line(img,(x1,y1),(x2,y2),(0,255,0),2)
'''for line in lines:
for ex in line:
print ex'''
imwrite('Lane1.png', img)
namedWindow("Image", WINDOW_AUTOSIZE)
namedWindow("Canny", WINDOW_AUTOSIZE)
imshow("Canny", edges)
imshow("Image", img)
waitKey(0)
destroyAllWindows()
There might be other errors in the code.
Please suggest some changes in the code.
line(img,(x1,y1),(x2,y2),(0,255,0),2)
?