After I have generated the Fundamental and Essential Matrix from Camera calibration, I am trying to get the Epipolar lines, and draw them in my images to test the Matrix I have generated, following this python-opencv tutorial
Here is the code for impelementing the drawing epipolar lines function:
def drawlines(img1,img2,lines,pts1,pts2):
''' img1 - image on which we draw the epilines for the points in img2
lines - corresponding epilines
'''
r,c = img1.shape
img1 = cv2.cvtColor(img1,cv2.COLOR_GRAY2BGR)
img2 = cv2.cvtColor(img2,cv2.COLOR_GRAY2BGR)
for r,pt1,pt2 in zip(lines,pts1,pts2):
color = tuple(np.random.randint(0,255,3).tolist())
x0,y0 = map(int, [0, -r[2]/r[1] ])
x1,y1 = map(int, [c, -(r[2]+r[0]*c)/r[1] ])
img1 = cv2.line(img1, (x0,y0), (x1,y1), color,1)
img1 = cv2.circle(img1,tuple(pt1),5,color,-1)
img2 = cv2.circle(img2,tuple(pt2),5,color,-1)
return img1,img2
but when I run the following code to generate the epipolar lines, I got this error:
Traceback (most recent call last): File "FundMat.py", line 124,
in img5,img6 = drawlines(img1,img2,lines1,pts1,pts2) File "FundMat.py", line 21, in drawlines img1 = cv2.circle(img1,tuple(pt1),5,color,-1)
TypeError: function takes exactly 2 arguments (1 given)
So, why I got this error and how to solve it?