0

I'm working on a school project made in python with opencv, and I have a question in two parts.

I have 6 photos of an object (one of each side) and one of a box filled with the same object. The quality of the photos is terrible, but my next tests will be made with better photos. My goal is to find the most reachable object in the box (in order to catch it). I am aware of the different algorithms of feature and contours detection, and I tried out some of them with the photos above, but I don't know which method would give me the greatest probability to find the most reachable object.

Now comes the second part. When I've found an object, I want to find its location in the picture, and I don't know how to exploit features or contour detection's result to get the position in pixel of the object.

This is my first post on stack overflow, and my first project with opencv, I'm sorry if the question in unclear, and I'm still doing some tests myself, but i count on programmers who already did something like this.

Community
  • 1
  • 1
bachinblack
  • 150
  • 12
  • For your first question try **SIFT** – Jeru Luke Feb 16 '17 at 05:07
  • After getting SIFT features perform **matching** – Jeru Luke Feb 16 '17 at 05:08
  • Thanks for your answer, I am not able to test it right now, but i'll do. I just have a simple question, isn't the fact that I have a box filled with the very same object a problem? Isn't SIFT gonna recognize every objects? – bachinblack Feb 16 '17 at 12:11
  • That is what you want isn't it? – Jeru Luke Feb 16 '17 at 13:36
  • 1
    I would use [ORB](http://docs.opencv.org/3.0-beta/doc/py_tutorials/py_feature2d/py_orb/py_orb.html), which is much faster than SIFT and should work for your problem. Run feature extraction and then description, do [knnMatch](http://docs.opencv.org/2.4/modules/features2d/doc/common_interfaces_of_descriptor_matchers.html) and then iterate over the matches to find the best – Rick M. Feb 16 '17 at 14:02
  • I'll try this one too. The purpose of my project is to find the object that's the easier to catch. The difficulty is to find the bigger and most complete object on the photo and ignore the others (the ones that will match the less) – bachinblack Feb 16 '17 at 14:50

1 Answers1

0

As suggested by Rick M in the comments, I tried out a solution using ORB keypoint detection.

I performed ORB keypoint detection for both the images given by you using THIS DOCUMENT.

Here is what I obtained:

enter image description here

enter image description here

There are other methods for obtaining keypoints. Visit THIS PAGE for more(SIFT, SURF, BRIEF, etc)

Then I performed Feature matching using THIS DOCUMENT:

enter image description here

As you can see I performed matches for just 5 keypoints. 3 of these keypoints appear to match correctly. I did not match all the keypoints or else it would not be clear. If you have a better image quality, most of the matches will be correct.

For this case I used Brute force matching. The documentation mentioned provides details on FLANN matching technique as well.

Community
  • 1
  • 1
Jeru Luke
  • 20,118
  • 13
  • 80
  • 87
  • Thanks for your answer, you're right, if I try with better quality images and with all keypoints, I might be able to find the best object. – bachinblack Feb 17 '17 at 13:56