Ask Your Question
1

Object detection using ORB gives more than acceptable number of false positive and false negatives

asked 2020-08-21 00:58:14 -0600

sanjaykthakur gravatar image

I have a template image and a bunch of test images to detect if the template image is present in them, by matching the features detected by ORB. I use the following piece of code

import cv2
import numpy as np

template_gray = cv2.imread(template_path, 0)
feature_detector = cv2.ORB_create()
temp_kp, temp_des = feature_detector.detectAndCompute(template_gray, None)
threshold = len(temp_kp)/4

matcher = cv2.BFMatcher(cv2.NORM_HAMMING, crossCheck=True)

test_gray = cv2_imread(<test_img_path>, 0)
test_kp, test_des = feature_detector.detectAndCompute(test_gray, None)
matches = matcher.match(temp_des, test_des)
if len(matches) > threshold: print("Object present")
else: print("Object missing")

I have tried many different combinations of threshold values. But none is working reliably across all test images. Too high of a threshold usually yields a lot of false negatives and too low of it gives too many false positives.

Can anyone tell me if there is a way to improve upon this situation or if this is the fundamental limitation of object detection by feature matching?

edit retag flag offensive close merge delete

Comments

(1) post the pictures you are working with (2) feature matching alone is useless. there need to be steps on top of that. I won't name them before you've posted real data because there are too many possibilities and this is a free forum.

crackwitz gravatar imagecrackwitz ( 2020-08-22 16:53:34 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
1

answered 2020-08-21 01:21:42 -0600

berak gravatar image

updated 2020-08-21 01:22:25 -0600

this is the fundamental limitation of object detection by feature matching?

yes, indeed. it's supposed to work with rotated/scaled parts of the same scene, but you cannot do "object detection" with arbitrary images this way.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2020-08-21 00:58:14 -0600

Seen: 512 times

Last updated: Aug 21 '20