When I run my python code
import numpy as np import cv2 import matplotlib.pyplot as plt img1 = cv2.imread(\'/home/shar/home.jpg\',0) # queryImage
This is probably a bug. What you can do is you can pass the 6th argument as None.
None
img3 = cv2.drawMatchesKnn(img1,kp1,img2,kp2,good,flags=2,None)
I was having a similar kind of problem when experimenting with SIFT. I was able to solve it when I used None as an argument.