In [ ]:
# Function for drawing lines
def drawlines(image1,lines,points1,points2):
    rows,columns = image1.shape
    image1 = cv2.cvtColor(image1,cv2.COLOR_GRAY2BGR)
    for r,pt1,pt2 in zip(lines,points1,points2):
        color = tuple(np.random.randint(0,255,3).tolist())
        x0,y0 = map(int, [0, -r[2]/r[1] ])
        x1,y1 = map(int, [columns, -(r[2]+r[0]*columns)/r[1] ])
        image1 = cv2.line(image1, (x0,y0), (x1,y1), color,1)
    return image1
In [ ]:
# Find epilines corresponding to points in right image (second image) and
# drawing its lines on left image
lines1 = cv2.computeCorrespondEpilines(points1.reshape(-1,1,2), 2,F)
lines1 = lines1.reshape(-1,3)
epilines_left = drawlines(image_left,lines1,points1,points2)
In [ ]:
# Find epilines corresponding to points in left image (first image) and
# drawing its lines on right image
lines2 = cv2.computeCorrespondEpilines(points1.reshape(-1,1,2), 1,F)
lines2 = lines2.reshape(-1,3)
epilines_right = drawlines(image_right,lines2,points2,points1)
In [ ]:
cv2.imshow("Left image",epilines_left)
cv2.imshow("Right image",epilines_right)
cv2.waitKey(0)