0

first of all, I have to say I'm new to the field of computervision and I'm currently facing a problem, I tried to solve with opencv (Java Wrapper) without success.

Basicly I have a picture of a part from a Model taken by a camera (different angles, resoultions, rotations...) and I need to find the position of that part in the model.

Example Picture:

enter image description here Model Picture:

desc

So one question is: Where should I start/which algorithm should I use?

My first try was to use KeyPoint Matching with SURF as Detector, Descriptor and BF as Matcher. It worked for about 2 pcitures out of 10. I used the default parameters and tried other detectors, without any improvements. (Maybe it's a question of the right parameters. But how to find out the right parameteres combined with the right algorithm?...) Two examples:

enter image description here

enter image description here

My second try was to use the color to differentiate the certain elements in the model and to compare the structure with the model itself (In addition to the picture of the model I also have and xml representation of the model..). Right now I extraxted the color red out of the image, adjusted h,s,v values manually to get the best detection for about 4 pictures, which fails for other pictures.

Two examples:

enter image description here enter image description here

I also tried to use edge detection (canny, gray, with histogramm Equalization) to detect geometric structures. For some results I could imagine, that it will work, but using the same canny parameters for other pictures "fails". Two examples:

enter image description here enter image description here

As I said I'm not familiar with computervision and just tried out some algorithms. I'm facing the problem, that I don't know which combination of algorithms and techniques is the best and in addition to that which parameters should I use. Testing it manually seems to be impossible.

Thanks in advance

gemorra

gemorra
  • 142
  • 13
  • I would try to first rectify the image, so warp it as though the camera would look in rectangular angle to the board (try to find line structures and rectangles). after that shape matching might work. For your canny treshholds you might want to try some color normalization first. – Micka Sep 09 '14 at 09:41

1 Answers1

2

Your initial idea of using SURF features was actually very good, just try to understand how the parameters for this algorithm work and you should be able to register your images. A good starting point for your parameters would be varying only the Hessian treshold, and being fearles while doing so: your features are quite well defined, so try to use tresholds around 2000 and above (increasing in steps of 500-1000 till you get good results is totally ok).

Alternatively you can try to detect your ellipses and calculate an affine warp that normalizes them and run a cross-correlation to register them. This alternative does imply much more work, but is quite fascinating. Some ideas on that normalization using the covariance matrix and its choletsky decomposition here.

McMa
  • 1,568
  • 7
  • 22
  • thanks for your suggestions. I will take a bunch of test images to find the optimum hessian threshold. What about other parameters? Like filter matches based on distance. Which Matcher should I use? FLANN, BF? – – gemorra Sep 09 '14 at 13:32
  • I normally get identical or similar results with both matchers, much more important is adjusting the number of neighbours you find... my guess is that k=1 should do, but computer vision is a lot about try and error :/ – McMa Sep 09 '14 at 14:22
  • ok, got it. As i wanted to try different pictures and adjust the threshold I ran into a strange problem. I opened a new question, because it's not directly connected to this one: http://stackoverflow.com/questions/25752497/keypoint-matching-just-works-two-times-java-opencv – gemorra Sep 09 '14 at 19:50