ImageEn for Delphi and C++ Builder ImageEn for Delphi and C++ Builder

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
Forum membership is Free!  Click Join to sign-up
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 Remove color
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

aleatprog

131 Posts

Posted - Nov 18 2022 :  07:43:31  Show Profile  Reply
Hi,

I need to automatically preprocess color scans in order to get the cleanest text for extraction.



Text recognition fails because the red line is too close to the text. Therefore, I tried to remove all red pixels using Proc.CastColorRange, but its tolerance starts to remove grey text pixels before all red pixels are removed. I tried also to clean up and increase image quality by implementing other preprocessing stages using AdjustBrightnessContrastSaturation, ConvertToGray & BN, WhiteBalance_AutoWhite, RemoveNoise, but all results got a poor or unstable recognition precision.

Has anybody an idea with which function the light red pixels can be removed by code without decreasing the text quality?

Al

xequte

38459 Posts

Posted - Nov 18 2022 :  17:28:34  Show Profile  Reply
Hi Al

Yes, that is not an easy document to scan. I would try parsing the scanlines yourself to find "Reddish" pixels, e.g. where R > 200, G < 100, B < 100, and make them white.

See the example at:

http://www.imageen.com/help/TIEBitmap.Scanline.html


If that is successful in nullifying the red pixels, then you might also then need to do some thresholding to try to increase the contrast between the text and the background.

Nigel
Xequte Software
www.imageen.com
Go to Top of Page

srtt

Turkey
24 Posts

Posted - Jan 08 2024 :  05:57:56  Show Profile  Reply
Has anyone found a solution to this problem or has any other suggestions?
I have that same problem.
Go to Top of Page

xequte

38459 Posts

Posted - Jan 08 2024 :  17:45:38  Show Profile  Reply
Hi

You can clean up the image a lot using...

Contrast3():


ConvertToBWThreshold():




StretchValues():


WhiteBalance_WhiteAt():



Nigel
Xequte Software
www.imageen.com
Go to Top of Page

srtt

Turkey
24 Posts

Posted - Jan 09 2024 :  07:31:30  Show Profile  Reply
thanks.
Go to Top of Page

xequte

38459 Posts

Posted - Jan 09 2024 :  14:54:50  Show Profile  Reply
Also, I was able to successfully extract the text via OCR from all of these.

Nigel
Xequte Software
www.imageen.com
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: