Did run some tests with the min_area and indeed a nice function as the axis is indeed rotating (because of the corners).
Will just have to use some Math to calculate the ANGLE of the rotation if I would need this further on.
BUT, probably I didn’t explain my challenge clearly enough, this min_area is not really able to solve the issue.
Objective: detect horizontal lines (some can be slightly tilted)
If I make my ROI too narrow(height), the blob function will not find lines (thresholds need to be lowered too much), certainly if they are a bit angled, as to few pixels fall inside the region of interest.
So I need to secure a high enough ROI so that I have enough pixels available to trigger the blob-function.
By making the ROI sufficient High enough, it of course will also detect other “blob-areas”. Most of them I can filter out.
BUT, in some minor cases I have pixels that are connected in a odd shape in a horizontal direction, making the blob trigger.
And at the same time this generates a elongated boundary box that looks extremely similar to a “horizontal line” even when using min_area.
So main issue is, to get a good horizontal line detection without having this false detection.
Currently I am thinking of adding a regression function in my ROI. I expect that the magnitude number of the returned line-object could perhaps give me an indication on how well the pixels are lined up.
But this will probably too sensitive. So still figuring out it I can come up with something else…
As far as I know this is the only way to determine if a triggered blob is just a combination of different shapes or really a long stretched shape of pixels.
- Picture of where I get a FALSE line detection. (because in this specific case the pixels are connected in width)
- Picture of a detected normal line
- Picture of a normal line that requires a high enough ROI, otherwise I wont be able to detect it (without lowering pixel threshold too much and create other noise). This I have covered, just showing example of failed detection if ROI is not high enough
Curious if magnitude could help or if I have to do some other tricks but still securing a robust process
I do not want to include to many crazy filters as it will most likely end up with a system that can only handle perfect images.