Is it possible to thicken lines of a binary image without thickening the ends?

16 views (last 30 days)
I m trying to thicken white lines on a binary image using the function
bwmorph(myImage, 'thicken')
however when the ends expand they are closing a space that I don't want closed. Is there a way to say identify the ends and exclude the ends from being thickened? I tried the dilate function also but this did the same.
So if I can use the skeleton option for bwmorph, I can identify end points, but when applying thicken can you do so ignoring identified end points?

Answers (1)

Image Analyst
Image Analyst on 3 Sep 2015
Identify the endpoints, then find a line from the endpoints back a few pixels. Then find the equation of the line perpendicular to that - hint: slope will be -1/slope. Then create a mask where it's true inside the line area and false outside the line area. Then dilate the line with imdilate and AND with the mask to "chop off" the pixels beyond the end of the line.

Categories

Find more on Read, Write, and Modify Image in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!