0

I need to compare two images to find the equality . I have searched a lot about AR and openCV. Already gone through compare two images in android and Tried OpenCV samples too . With OPENCV only ORB is free to use and it will compare images in GrayScale and thats not what i need.

P.S:- The need is i have 4 images of a object in my app. SO if user scan a real object using camera then i need to figure out the object in this scanned image does match any of the object in those 4 images or not. I know it way off-topic and also too broad as per SO standard but I really need help on this.

EDIT:- After trying some algos from github i stumble upon on This project . And the results are quite satisfying . I already have tested it with several templates . I am stuck here with one problem . I need to show to user whether the object found or not(a boolean) . How can i determine this if object is detected correctly or not ? Putting some final step code below.

        Point point1=new Point(sceneCorners.get(0,0));
        Point point2=new Point(sceneCorners.get(1,0));
        Point point3=new Point(sceneCorners.get(2,0));
        Point point4=new Point(sceneCorners.get(3,0));
        Imgproc.line(rgb, point1, point2, new Scalar(0, 255, 0), 4);
        Imgproc.line(rgb, point2, point3, new Scalar(0, 255, 0), 4);
        Imgproc.line(rgb, point3, point4, new Scalar(0, 255, 0), 4);
        Imgproc.line(rgb, point4,point1, new Scalar(0, 255, 0), 4);

the 2 points are found on each detection . How can i determine that it detected the object or not ? Some things i already tried :
1. Check for rectangle formed with those points:- This can fail .

What is the recommended approach for solving this problem. I have searched a lot most of every sample on github but not found a solution for this . Please let me know which approach should i follow ?

Diaz diaz
  • 284
  • 1
  • 7
  • 21
  • 1
    What is wrong with using ORB with GrayScale? If you just need to know if the scanned object is in the four images you could use ORB (depending on how feature rich the images are). Or you could try using template matching (with/without windowing technique) – Rick M. May 24 '18 at 11:02
  • With what is i scan a Silver coin and compare it to a gold coin ? I think it will show both are same ? – Diaz diaz May 24 '18 at 11:03
  • In that case, posting some example images might be helpful. If you can't do that, use template matching for all three channels of the image (R vs R, G vs G, B vs B), this is for sure an overkill because if it gold and silver coin, after finding the match you can just compare the colors. – Rick M. May 24 '18 at 11:06
  • The problem is image can be anything of a rigid object . So i think i need to remove the background first from scanned image then compare it some how. Am i right ? Can you provide some links for implementing this in android ? – Diaz diaz May 25 '18 at 08:54
  • Ideally you will do that but without seeing the images I can't say if this is the best way and hence no point in providing links. – Rick M. May 25 '18 at 08:56
  • Yeah this is confusing for me too . lets say i have 4 image of a teddy in my app . So if i capture the image of same teddy from camera then i need to detect wether they are similar or not despite of having different background. Please provide a better approach . – Diaz diaz May 25 '18 at 09:10
  • Until and unless you try the methods I mentioned in the above comments (template matching / ORB) or some other method you can't use _better approach_ because that is used only relative to something that you've done. – Rick M. May 25 '18 at 09:18
  • @RickM. i am using this [Github project](https://github.com/ykenichi/ObjectFinder) to detect the object . Its working well but i am stuck in making decision whether the object is detected or not. Cause it is drawing a rect on detected object but i can not find a way to make a decision that we have the object detected and proceed further. Can you help ? – Diaz diaz May 30 '18 at 03:29

0 Answers0