Page 1 of 1

Finding horizontal bars

PostPosted: Mon Sep 16, 2019 12:33 am
by JerryNixon
Hi, my goal is to locate the horizontal bars in the attached image. I want to use their location, horizontal length, and vertical thickness to infer their part of the label. That's the goal.

I started by using BlobCounter since they look like rectangles to me. But this is unreliable. It tends to miss them. Perhaps the text is too close.

I thought about the horizontal edge and somehow using that to identify the horizontal bars. Not sure that's a good approach or not, but I'm a little stuck. Not quite sure how.

Thank you for any help you can offer.

Jerry

Re: Finding horizontal bars

PostPosted: Mon Sep 16, 2019 11:42 am
by andrew.kirillov
Hello,

May not be perfect but here is what I got quickly in IPLab. Just as a starting idea ...

Steps are:
1) Grayscaling
2) Edge detection (Homogenity)
3) Thresholding
4) Morphology Hit-and-Miss, used 3x3 kernel (0,0,0,1,1,1,-1,-1,-1) to detect horizontal elements.
5) Blob filtering by size to remove short line.

Image 5.png
Image 5.png (1.96 KiB) Viewed 6270 times

Re: Finding horizontal bars

PostPosted: Mon Sep 16, 2019 2:59 pm
by JerryNixon
This is very nice. I will need to install IPLab and see what you mean. If you have any code samples, I eagerly welcome them, esp. #4. /Jerry

Re: Finding horizontal bars

PostPosted: Wed Sep 18, 2019 9:46 pm
by N3rd007
Hello Andrew,
I am working with Jerry on a project, and I am trying to reproduce your results using your too IPLabs. I am struggling to figure out what settings you used for two of the steps and was wondering if you could share your thoughts.

In the steps thresholding and "blob filtering by size to remove short line" what settings did you use to get such great results?

Thanks for any thoughts!

Best regards,
Travis

Re: Finding horizontal bars

PostPosted: Thu Sep 19, 2019 7:06 am
by andrew.kirillov
Hello,

There is preview area, you can always play with the settings.

For thresholding I used something like 64. For blob filtering I think I set min width to ~40 and min height kept as is (1).