MATLAB: Segmentation of dark lines when background is darker a bit.

image processingImage Processing Toolboximage segmentation

Helloo, Can someone suggest me how I can do good segmentation of lines, I want to extract those darker lines. I tried normal thresholding but the background is too dark to give me a good result.

Best Answer

You can use a modification of an algorithm used to find text on varying background. Basically you scan and do a local Otsu filter. Then you scan and find the local Sobel edges, then take the std dev of that and threshold. Then AND to find only blobs that are locally varying. Then do some cleanup by finding only tall and dark blobs that are large enough. Code is attached. There are a lot of parameters in my well commented code that you can vary to achieve different effects. I've already spent way more time on this than I normally do for people, so I'll leave that to you. Good luck.