The main goal was to find the principal direction of the pattern in an image and to orient the image accordingly. So far, I have tried to use the code from Mathematica Image Processing tutorial (Analyze Orientations in an Image) and an SE answer bellow the following link: Image Processing: Finding Orientation and Position of Symmetry Axes
However, both methods are not working as they should and images have to be rotated manually with
ImageRotate. In this example image would have to be rotated for approximately 45° in order to align the pattern principal orientation axes with the horizontal and vertical directions.
I think that the main problem is small size of white pockets without dominant dimension. Global orientation of the pattern can only be seen when looked upon an image from far away.
It is important to add that I am looking for the orientation of white-spot pattern and not the orientation of the rectangular net. Nevertheless, your suggestions are really nice, because they deal with problem from different angles.
Before reading your answers I was trying to do something considering the comments from @nikie. What I found out was that the
EdgeDetect is very sensitive to the r parameter definition. Besides, "RANSAC" method in
ImageLines turned out to be a better predictor than the default "Hough" method.
As already mentioned, the change of method to "RANSAC" with default t and d parameters was crucial improvement in the quality of the results. In this case we have a lot of outliers in the data and "RANSAC" is more suitable in assigning no influence to them than the "Hough" method. I will try your suggestions, too, in order to get the best method for line-pattern recognition.