What is the best way for complex fit

I need to know what is the best way to match a specific shape (pattern) in an image.

I know that there are several ways, but some of them did not lead to very good results, and the other needs a lot of time for the process, so each of them tried a good and fast way to perform a comparison with a short process time.

For example, this is a template ...

enter image description here

And I have a pattern, and I want to compare the pattern with the pattern and return true, if the pattern is similar to the else pattern, returns false.

Note. I tried contour matching, Cascade Classification and SURF, but they are all not very good or the process time is not so good.

+6
source share
1 answer

Combining things with eachother can be quite a challenge, mainly due to the fact that different methods have very different characteristics and can give almost perfect results in some categories and very poor results for others.

That says, I don’t think you will ever get the answer to your question, at least not the one that says "Use the xyx method from [cited article] that will solve all your problems." I will try to point out a few examples so that you hope this helps.

Pattern matching operator : compare a template with a sliding window on your image, you can achieve very good results if your template is very similar to the object you are looking for in the image, no matter how complicated it is. It can be very fast, it is not practically unchanged, so if you plan to have a turn, significant changes in lighting or something else, this probably will not work for you. here you can find out some code. Inspect which color space you use, different color spaces can achieve very different results if they are used correctly (for example, for face analysis, HSV may be better than RGB in some cases)

Matching keywords like SIFT or SURF: I used it very well with very good results. You will need to decide which handle to use and which socket. OpenCV has some nice examples, you can find them here. It will not be the fastest way to map your object, since these descriptors can take some time to be extracted, it is good if you do not know much about the conditions in which you will work, though: they are usually reliable for scaling, rotation and lightning changes so long that key points can be correctly found on both the template and the image.

Conformity of form . I was quite surprised when in the image classification contest I participated in, I was able to use a simple HOG descriptor to get very different information about my images. Oriented gradient histograms are a fairly powerful tool for describing the shape of an object; it uses the orientation and edge size to describe your image. They can be fast to compute (OpenCV has a GPU implementation, I think), customizable (you can decide how thick your grid can be and how many cells, which leads to very different information). HOGs are not rotationally invariant, since an object at a different angle most likely creates a different histogram, but they are very reliable for changing lighting due to the fact that color is not used. HOG is just an example, there are many descriptions of the shape and contour, but basically they offer almost the same thing as I think.

Matching histograms : not my first choice, this can be useful if you know something about the subject and the rest of the image. For example, if you know that you are looking for your pink flower in the image of the jungle, where it is the only pink thing, a simple comparison of the color histogram will be fine. Take a sliding window, run it in your image, compare the histograms, and you're done. Very fast, very simple, it does not use the form at all, regardless of the complexity of your object, you will find it. Not using the form makes it resistant to bends, but watch out for changes in lighting. The very big limitations of this method are that if there are other pink things in your jungle, you cannot tell them apart.

Hybrid approaches : here you can get the most out of the methods above. As you saw, most of them work well in a certain environment and rather poorly in others. You can use a combination of methods that you know and get something much better than the sum of the parts. I worked a lot with HOG and head posture assessment, and a real breakthrough came when we started to extract the HOG not in a tight manner, but around certain key points. You need to know your problem, find out what you need, and adapt many methods to it. In general, hybrid methods can work much better and much slower.

Hope this helps you a bit, I don’t think that, given the information you gave us, I could give you a much better answer .. (maybe someone else can, so I'm still a student :))

+11
source

All Articles