Can we use surf detectAndCompute function for multiple images -OpenCV - Python
I want to match images using multiple train images.
This what I'm expecting to do
import cv2 import matplotlib.pyplot as plt import numpy as np
surf=cv2.xfeatures2d.SURF_create(400) img=[] //train images img.append(cv2.imread('test_images/frame964.jpg',0)) img.append(cv2.imread('test_images/frame112.jpg',0))
//test image test_img = cv2.imread('test_images/frame300.jpg',0)
//problematic in here kp1,des1=surf.detectAndCompute(img,None)
kp2,des2=surf.detectAndCompute(test_img,None)
bf = cv2.BFMatcher(cv2.NORM_L1, crossCheck=False)
matches = bf.match(des1,des2) matches = sorted(matches, key = lambda x:x.distance) img3 = cv2.drawMatches(roi,kp1,frame,kp2,matches[:10], None,flags=2)
cv2.imwrite("outputimage.jpg",img3)
This is not working in python. It gives an error in here
kp1,des1=surf.detectAndCompute(img,None)
Error is : kp1,des1=surf.detectAndCompute(img,None) TypeError: image is not a numpy array, neither a scalar
I saw a C code by making vector images and match them. Is there any possibility of doing this in python. Is there any approach for this ?