Page 1 of 1
Patern Recognition
Posted: 2011-05-27T11:38:46-07:00
by w.c
Hi, I'm new with ImageMagick,
I want to recognize a Black / White pattern from several TIFF files
The file has some regions with Hand writing and (Black) and spaces between each paragraph.
I want to determinate how many paragraphs has the image, The best way I thought was ising the im_profile Script from here
http://www.imagemagick.org/Usage/scripts/im_profile and then count the the Blank Spaces.
However is not quite simple, according to the image.
How I can pre process the image to get this working?
There is other way to get this result?
Can somebody help me?
Thanks a lot
Re: Patern Recognition
Posted: 2011-05-27T12:32:05-07:00
by fmw42
try this. it should make a binary image with white for the paragraphs and black elsewhere. does that help.
convert 014092021H_example.png -alpha off -statistic maximum 5x5 \
-fuzz 3% -fill black +opaque "rgb(198,181,181)" \
-fill white -opaque "rgb(198,181,181)" 014092021H_example_test1.png
And this will convert the above into a profile
convert 014092021H_example_test1.png -scale 1x373! -rotate 90 MIFF:- |\
im_profile - 014092021H_example_test1_profile.gif
Note the above is on Linux/Mac (Unix). Windows commands are somewhat different and im_graph script is bash shell script. For windows users see IM differences at
http://www.imagemagick.org/Usage/windows/
Re: Patern Recognition
Posted: 2011-06-01T09:46:09-07:00
by w.c
I really appreciate your help and experience
I'll try and I post the result here, maybe this can help Others
After running the command
convert: unrecognized option `-statistic' @ error/convert.c/ConvertImageCommand/2688.
Ubuntu 10.10
ImageMagick 7:6.6.2.6-1ubuntu1.1
Installed from the repository
Thanks for your help
Re: Patern Recognition
Posted: 2011-06-01T10:51:59-07:00
by fmw42
your IM version is too old. there is no such version as 7:6.6.2.6 and so you probably mean 6.6.2.6. The -statistics came at version 6.6.9-3. However, you can do the same with -morphology dilate square:1 should be the same as -statistic maximum 3x3. Othwise upgrade your IM version.
Re: Patern Recognition
Posted: 2011-06-01T10:53:16-07:00
by fmw42
your IM version is too old. there is no such version as 7:6.6.2.6 and so you probably mean 6.6.2.6. The -statistics came at version 6.6.9-3. However, you can do the same with -morphology dilate square:2 should be the same as -statistic maximum 5x5. Note morphology was undergoing changes and improvements, but should be ok for your release. However, you can check the changelog for more details at
http://www.imagemagick.org/script/changelog.php. Othwise upgrade your IM version.
convert 014092021H_example.png -alpha off -morphology dilate square:2 \
-fuzz 3% -fill black +opaque "rgb(198,181,181)" \
-fill white -opaque "rgb(198,181,181)" 014092021H_example_test1.png