Page 1 of 2

Change the bold level of the text

Posted: 2016-01-11T18:23:39-07:00
by user20157
Do you know any formula that i can use to reduce the bold level of the text(make it thinner and less dark) on this picture
http://imgur.com/OA6vKyN
to look similar to this :
http://i.stack.imgur.com/A2Dq2.png
Thank you very much,

Re: Change the bold level of the text

Posted: 2016-01-11T18:43:47-07:00
by fmw42
The only thing I can suggest is to use -morphology dilate octagon:X followed by +level Yx100%

X is the size of the octagon shape for the -morphology to make the text thinner. Start with X=1 and try larger integers. Or use -morphology dilate disk:X, where X is a float.

See
http://www.imagemagick.org/Usage/morphology/#kernel
http://www.imagemagick.org/Usage/morphology/#basic


Y is the percent less dark you want, where 0% is full dark. So try Y=20% or something else as desired.


convert image -morphology dilate octagon:1 +level 20x100% result


But this will shrink your accent marks and perhaps even make them disappear.

Re: Change the bold level of the text

Posted: 2016-01-11T18:55:35-07:00
by user20157
yeah. It totally shrinks the image. Do you know anyway i can fix that?

Re: Change the bold level of the text

Posted: 2016-01-11T19:27:41-07:00
by fmw42
What do you mean by shrinks the image? The image dimensions should not change!

Once your text is in pixel format (versus vector data), it is impossible to change fonts until you have done OCR. All you can do is try to thin out the fonts if the fonts are too thick.

Re: Change the bold level of the text

Posted: 2016-01-11T21:29:51-07:00
by user20157
sorry i mean not reducing the accent mark.

Re: Change the bold level of the text

Posted: 2016-01-11T21:46:01-07:00
by fmw42
No, the thinning is global, so affects everything.

Is this not acceptable?

Code: Select all

convert OA6vKyN.png -alpha off -morphology dilate disk:1.3 result.png
Alternately, create the thinned result as above (or change the 1.3 to something else). Then create an image only of the accent marks from the original. Then combine them as the minimum graylevel of the two images after deleting the original. But that is only slightly better.

Code: Select all

convert OA6vKyN.png -alpha off \
\( -clone 0 -morphology dilate disk:1.3 \) \
\( -clone 0 -negate -morphology tophat disk:4.2 -negate -threshold 40% \
-define connected-components:area-threshold=20 \
-define connected-components:mean-color=true \
-connected-components 4 \) \
-delete 0 -evaluate-sequence min result.png

Re: Change the bold level of the text

Posted: 2016-01-11T23:45:23-07:00
by user20157
Yes. Your method produces better accuracy. But it can't still produce 100 % accuracy. When i took a screenshot from my wordpad program it produce 100 % accurarcy but even for images taken elsewhere with the same level of text thickness the accuracy is just about 70 %. It seems that i have to fix other image properties as well but i don't know what they are :(

Re: Change the bold level of the text

Posted: 2016-01-12T00:36:48-07:00
by fmw42
Sorry, I do not understand what you have done to get 100% accuracy from Wordpad? I do not know any further way to improve your results.

Re: Change the bold level of the text

Posted: 2016-01-12T01:07:14-07:00
by user20157
i used Tesseract for extracting text from images. All i did to get 100% accuracy from Wordpad is to type the some words in Vietnamese into the Wordpad program and take a screenshot of it(printscreen). Afterwords i run the Tesseract:tesseract imagename filename -l vie and received 100% text accuracy.

Re: Change the bold level of the text

Posted: 2016-01-12T01:09:08-07:00
by user20157
This is the link to that image which i sent you on last posts: http://i.stack.imgur.com/A2Dq2.png

Re: Change the bold level of the text

Posted: 2016-01-12T01:52:14-07:00
by Bonzo
Why not try OCR and re create the image?

Re: Change the bold level of the text

Posted: 2016-01-12T02:04:17-07:00
by user20157
what do you mean ?

Re: Change the bold level of the text

Posted: 2016-01-12T02:08:00-07:00
by user20157
I tried Tesseract

Re: Change the bold level of the text

Posted: 2016-01-12T03:38:04-07:00
by Bonzo
OCR = Optical character recognition

Re: Change the bold level of the text

Posted: 2016-01-12T05:01:08-07:00
by user20157