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 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!