Page 1 of 1

Filling the gaps made in pixels due to line removal

Posted: 2017-10-22T04:48:09-07:00
by wineismine
Recently i saw a topic about line removal using leptonica.http://www.leptonica.org/line-removal.html.So i tried it in imagemagick and i made it till
Figure 9
Image
But i cant figure out the correct command for the Final figure which fills up the mixing pixels only in the image(which is below).So please help me.
Image

Re: Filling the gaps made in pixels due to line removal

Posted: 2017-10-22T05:43:36-07:00
by snibgo
I've written a couple of web pages on the topic, plus code -- search "filling holes" on my web page.

The example on your link uses a morphological open to join lines across the gap. My hole-filling code copies suitable areas from elsewhere in the image. The gap is only 2 or 3 pixels high, so they should work fine. Almost anything could be used, such as a vertical blur.

I've also written a page about joining broken lines, but that's mostly designed for binary images.

Re: Filling the gaps made in pixels due to line removal

Posted: 2017-10-22T18:46:15-07:00
by wineismine
where to save the script file fillholespri?
magick: unable to load module `fillholespri' @ error/module.c/InvokeDynamicImageFilter/1663.

Re: Filling the gaps made in pixels due to line removal

Posted: 2017-10-22T20:20:36-07:00
by fmw42
This is not perfect, but try

Unix:

Code: Select all

convert dave-proc8.png \
\( -clone 0 -morphology convolve blur:0x5+90 -level 50x100% \) \
\( -clone 0 -threshold 99% -blur 0x1 \) \
-compose over -composite -level 30x100% \
result.png

Windows:

Code: Select all

convert dave-proc8.png ^
( -clone 0 -morphology convolve blur:0x5+90 -level 50x100% ) ^
( -clone 0 -threshold 99% -blur 0x1 ) ^
-compose over -composite -level 30x100% ^
result.png
Image

Re: Filling the gaps made in pixels due to line removal

Posted: 2017-10-22T20:37:27-07:00
by snibgo
fillholespri.c isn't a script, but C code. Put it in the "filters" directory of your IM source, and re-build IM. Instructions are in Process modules.