3

I am working in logo detection application in OpenCV on Android. I have a lot of searches and find that for this purpose most of the time feature detection is used.

So I searched and tried different detectors and matchers, and finally I have written a code that works well with ORBFeatureDetector and BruteForce matcher :

private DescriptorMatcher BruteMatcher = DescriptorMatcher.create(DescriptorMatcher.BRUTEFORCE_HAMMING);

I found the number of matches and minimum distance and number of good matches like this :

 List<DMatch> matches = mat_of_matches.toList();
        double max_dist =0, min_dist= 100;
        int row_count = matches.size();
        for(int i=0;i<row_count;i++)
        {
            double dist = matches.get(i).distance;
            //System.out.println("dist="+dist);
            if(dist<min_dist)min_dist = dist;
            if(dist>max_dist)max_dist = dist;


        }


       // Log.e("Max_dist,Min_dist", "Max="+max_dist+", Min="+min_dist);
        List<DMatch> good_matches = new ArrayList<DMatch>();

        double good_dist = 3*min_dist;

        for(int i =0;i<row_count; i++)
        {

            if(matches.get(i).distance<good_dist)
            {

                good_matches.add(matches.get(i));
                //Log.e("good_matches", "good_match_id="+matches.get(i).trainIdx);

            }

        }

, and finally I created a threshold like this :

if(row_count>490&&good_matches.size()<60&&min_dist<12)logo_detected=true;
else logo_detected=false;

The problem is that for many other things that are also in the threshold accessed and the application keeps saying the logo is detected .

I want to know what should I do with detected matched features? Is it the right thing to do (thresholding)? Or do I need to do something else to detect the logo ?

Please help, thanks.

Raul Rene
  • 10,014
  • 9
  • 53
  • 75
Abdul Rehman
  • 2,224
  • 25
  • 30
  • the bruteforve matcher detects probably too much, that is clear. to help you, one has to know what your logo looks like. for example, if it would have a specific form, like an ellipse, you could run an ellipse detection on everything detected by the bruteforce matcher. OpenCV can detect loads of stuff, just look for something, that would narrow the detections down to fewer hits. – Martin Hennig Oct 25 '12 at 21:41

0 Answers0