2017-01-09 1 views
0

비디오의 현재 프레임을 미리 저장된 피쳐 설명자와 비교하여 알려진 객체를 탐지하려고합니다. 내 생각은 현재 프레임의 피쳐를 미리 저장된 피쳐와 대조하고, 양호한 피쳐의 수가 특정 임계 값 이상인 경우 긍정적 인 감지를보고하는 것입니다.오브젝트가 OpenCV의 씬에 없을 때`DescriptorMatcher`는 무엇을합니까?

그러나 DescriptorMatcher은 개체가 실제로 장면에 있는지 여부에 관계없이 항상 일치하는 고정 된 숫자를보고하기 때문에 작동하지 않는 것처럼 보입니다. 좋은 평범한 필터링 기법을 사용하여 최상위 x 개의 일치 항목을 유지하지만, 여전히 현재 프레임과 관련된 측정 항목입니다.

잠재적으로 하드 임계 값으로 사용할 수있는 DescriptorMatcher과 같은 항목이 있습니까? 이것에 대한 더 나은 접근법이 있습니까? 전에 Bag of Words를 사용해 왔지만 현재 문제의 비트를 과도하게 지나치게 많이 보였습니다. 또한 내 요구 사항에 너무 철저한 계산이었습니다. 모든 제안/팁/포인터를 부탁드립니다.

ImageDescriptor imageDescriptor = null; 
imageDescriptor = ImageDescriptor.fromJson(jsonMetadata); 
Mat storedDescriptors = imageDescriptor.getFeatureDescriptors(); // prestored features 

FeatureDetector featureDetector = FeatureDetector.create(FeatureDetector.ORB); 
DescriptorExtractor descriptorExtractor = DescriptorExtractor.create(DescriptorExtractor.ORB); 
DescriptorMatcher descriptorMatcher = DescriptorMatcher.create(DescriptorMatcher.BRUTEFORCE_HAMMING); 

MatOfKeyPoint keyPoints = new MatOfKeyPoint(); 
featureDetector.detect(rgba, keyPoints); // rgba is the image from current video frame 

MatOfDMatch matches = new MatOfDMatch(); 
Mat currDescriptors = new Mat(); 

descriptorExtractor.compute(rgba, keyPoints, currDescriptors); 
descriptorMatcher.match(descriptors_scene, storedDescriptors, matches); 

MatOfDMatch good_matches = filterMatches(matches); // filterMatches return the matches that have a distance measure of < 2.5*min_distance 

if(good_matches.rows()>threshold) 
    return true; 

return false; 

답변

0

descriptorMatcher 항상 찾아 (또는 찾습니다) 최상의 상대 (= smalles 거리와 일치하는) 것, 그것은 일치 실제로 정말 맞다 여부를 말할 수 없다. 어떤 경기가 맞는지 추측 할 수있는 몇 가지 접근법이 있습니다.

  1. 경기의 장애를보세요. 거리 값이 너무 크면 일치하는 것입니다 (모든 키포인트 중에서 가장 작은 거리 임에도 불구하고).

  2. 최상의 일치를 계산하는 대신 2 번째로 가장 좋은 일치를 계산하십시오. 2 위와 가장 좋은 경기가 거의 같은 품질 (= 같은 거리) 인 경우, 그 중 하나가 좋은 경기라는 것을 결정할 수 없다고 생각할 수도 있습니다.

  3. 은 RANSAC을 사용하여 강력한 호모 그래피를 계산합니다. 일치 항목에 충분한 inlier가 있으면 해당 일치 항목이 매우 강력 할 수 있습니다.

  4. 4. 같은

    대신 호모 그래피의 기본 매트릭스

을 확인,하지만 어쩌면 이것 좀하지 않았다 : https://github.com/opencv/opencv/blob/master/samples/cpp/tutorial_code/calib3d/real_time_pose_estimation/src/RobustMatcher.h

http://docs.opencv.org/3.1.0/dc/d2c/tutorial_real_time_pose.html

+0

덕분에, 정확히 나는 찾고 있었다! –