# Processing for text extraction

**URL:** <https://forum.opencv.org/t/processing-for-text-extraction/9541>\
**Category:** Python\
**Tags:** ocr, text, tesseract\
**Created:** [July 19, 2022, 3:16pm UTC](https://forum.opencv.org/t/processing-for-text-extraction/9541 "2022-07-19T15:16:39Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Atef08](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/atef08/32/4189_2.png) [@Atef08](https://forum.opencv.org/u/Atef08)\
**Post date:** [July 19, 2022, 3:16pm UTC](https://forum.opencv.org/t/processing-for-text-extraction/9541/1 "2022-07-19T15:16:39Z")

</div>

Hi,  
I am working on a project to extract information from driver’s licenses.  
The extraction is good with some images and bad with others.  
I tried different image processing to improve the quality of the extraction. It helps but not with all the images because the images don’t have the same degree of blur, luminosity… (I tried all kinds of filters but I didn’t find a good filter for all the images).  
So I calculated the blur and brightness of all the images to find a filter criterion or condition, but the result was not clear to me.  
Any suggestion to understand which filter I should use?

---

<div class="post-metadata">

**Author:** ![Steve\_in\_Denver](https://avatars.discourse-cdn.com/v4/letter/s/eada6e/32.png) [@Steve\_in\_Denver](https://forum.opencv.org/u/Steve_in_Denver)\
**Post date:** [July 19, 2022, 7:58pm UTC](https://forum.opencv.org/t/processing-for-text-extraction/9541/2 "2022-07-19T19:58:00Z")

</div>

It sure would help if you provided example images, including ones that work and ones that don’t.

---

<div class="post-metadata">

**Author:** ![Atef08](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/atef08/32/4189_2.png) [@Atef08](https://forum.opencv.org/u/Atef08)\
**Post date:** [July 19, 2022, 9:30pm UTC](https://forum.opencv.org/t/processing-for-text-extraction/9541/3 "2022-07-19T21:30:44Z")

</div>

I used this filter:

> image=cv2.imread(“q.jpg”,0)  
> image=cv2.cvtColor(image, cv2.IMREAD\_COLOR)  
> img11 = cv2.resize(image, None, fx=2, fy=2, interpolation=cv2.INTER\_CUBIC)  
> dst = cv2.fastNlMeansDenoisingColored(img11, None, 10, 10, 7, 15)  
> ![austrian](https://us1.discourse-cdn.com/flex020/uploads/opencv/original/2X/f/f32762616eab829e8d85ae5381a914b72961f535.jpeg)  
> and this pic works.
