I have a binary image, and for simplicity lets assume it's a simple straight line:
00000000000000
00000000000000
00000000000000
11111111110000
00000000000000
00000000000000
00000000000000
and I want to extend it for 2px.
For that purpose I applied dilation with two iterations and as expected got this:
00000000000000
11111111111100
11111111111100
11111111111100
11111111111100
11111111111100
00000000000000
then, my idea was to simply apply thinning and get initial line extended by two pixels. But instead, I got shortened line, probably because of line thickness:
00000000000000
10000000000000
10000000000000
11111111100000
10000000000000
10000000000000
00000000000000
I then thought to apply dilation with diamond shape structuring footprint instead 3x3 ones(), but result was worse - line was shortened for one more pixel.
For thinning I used Zhang-Suen algorithm and Guo-Hall algorithm, and I also tried Otsu method exposed by skimage, which yielded similar result.
Can someone tell me about existence of thinning algorithm that can get me where I headed, or maybe different approach?
Update (to address @marinus comment):
As mentioned, I like to extend the initial line for 2px and get:
00000000000000
00000000000000
00000000000000
11111111111100
00000000000000
00000000000000
00000000000000
while I can't with my thinning approach, because thinning seems to work this way:
So by just dilating initial line, I can't possibly extend it with thinning.