# Advice regarding pattern recognition on images

I'm trying to extract the pattern from an image of a textile material. Been busting my head lately with this on this one. Given the fact that it's a textile material, there might be portions of it with deformations, therefore the patterns can be slightly different. My current method of finding the pattern is the following: (let's say the input image is A)

-Apply Akaze on image A with image A. Get a 200x200 portion of the image with the highest density of feature points, resulting with an image B of size 200x200.

-Apply Akaze on Image A and B.

-Filter the feature points.

-Get the most recurring feature point.

-Out of the most recurring feature points get the one with the lowest X and the one with the lowest Y.

-Having such a feature point, calculate the distance on X and on Y with the nearest feature points from it.

-End up with a rectangle inside which we have a tile of the pattern.

Well, in theory all good. Tested it and it works in 80% of cases. But in some it doesn't. Why? Well, I end up with some false positives. (I draw a blue circle around the feature points I'm using for calculating the distance) Due to the fact that the image has portions so similar yet different as a whole, I end up some time with a wrong tile. An example is this one, where in the middle I have a feature point which isn't supposed to be there but, due to the fact that the respective portion is so similar, it's easy to understand why and how it got there. What isn't easy, is how to ignore it. In the image with the smaller rectangle, I end up with a false tile, in the one with the bigger rectangle, I end up with an almost perfect one.

My question here is, how could I improve my method so it takes into account only the correct feature points? I'm also open to new methods regarding the improvement of the algorithm or regarding a whole new approach. Thank you!

maybe this is related with the subject you work on it.

Thank you! The article proved to be really useful!

see also : SEAM CUT

First of all, Happy New Year! I thank you for your support, I highly appreciate it! The seam cut method presented on that post is quite amazing actually and proved to be helpful in a manner. The thing I'm facing with now is trying to detect multiple instances of an object in an image. I ended up with a close to 90% during the pattern extraction, now I want to find all the instances of that pattern in an image. The image can be deformed, given the fact that the pattern will be a real time photo of a textile material, and even rotated. Therefore a simple template matching is obvious out of discussion. Unfortunately I can't train a SVM given the fact that most of the time I have different image sources, finding different patterns and so on. Do you have any idea regarding this subject?