I'm trying to implement a program to detect and track players, and I've been testing the ORB Detector with these Matchers: FlannBased, BFMatcher. I've even tried these matchers with the SIFT Detector, but I am getting the same results with all of them. This image shows basically what I'm getting: ORB With FlannBased Matcher
As you can see, the matching between the two images it's mainly focused on the structure of the stage but not on the players. I don't know if there is a way to make the detector focus only on the people. I am open to suggestions!! Also, I would like to know if there is some kind of restriction in the quality of the image
This this is the code that I used to get the image above
#FLANN based Matcher With ORB Descriptors
import numpy as np
import cv2
from matplotlib import pyplot as plt
img1 = cv2.imread('Imag-Prueba.png',0) # queryImage
img2 = cv2.imread('Imag-Prueba-2.jpg',0) # trainImage
# Initiate ORB detector
orb = cv2.ORB_create(nfeatures=10000, scoreType=cv2.ORB_FAST_SCORE)
# find the keypoints and descriptors with ORB
kp1, des1 = orb.detectAndCompute(img1,None)
kp2, des2 = orb.detectAndCompute(img2,None)
# FLANN parameters
FLANN_INDEX_LSH = 6
index_params= dict(algorithm = FLANN_INDEX_LSH,
table_number = 12, # 12
key_size = 12, # 20
multi_probe_level = 2) #2
search_params = dict(checks=100) # or pass empty dictionary
flann = cv2.FlannBasedMatcher(index_params,search_params)
matches = flann.knnMatch(des1, des2, k=2)
# Need to draw only good matches, so create a mask
matchesMask = [[0,0] for i in range(len(matches))]
# ratio test as per Lowe's paper
for i, m_n in enumerate(matches):
if len(m_n) != 2:
continue
elif m_n[0].distance < 0.80*m_n[1].distance:
matchesMask[i]=[1,0]
draw_params = dict(matchColor = (0,255,0),
singlePointColor = (255,0,0),
matchesMask = matchesMask,
flags = 0)
img3 = cv2.drawMatchesKnn(img1,kp1,img2,kp2,matches,None,**draw_params)
cv2.imwrite('ORB-FLANNMatcher-0.8.jpg',img3)