Did try to implement suggestion from documentation?
https://github.com/tesseract-ocr/tessdoc/blob/main/ImproveQuality.md


Zdenko


pi 24. 6. 2022 o 16:59 Hervé <[email protected]> napísal(a):

> Hi, I need some help to make tesseract-OCR recognize digits : can't
> achieve to make this work with
>
>
> https://img.super-h.fr/images/2022/06/24/9a03414616bc4c6bd6e4bdb78e9d6783.jpg
>
> here is my code :
>
>
>
> import cv2
> import pytesseract
>
> pytesseract.pytesseract.tesseract_cmd ="C:\\Program
> Files\\Tesseract-OCR\\tesseract.exe"
>
> def process_image(img):
>     #cv2.imshow('Img',img)
>     #cv2.waitKey(0)
>
>     ### passage en niveau de gris
>     gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
>     #cv2.imshow('Img',gray)
>     #v2.waitKey(0)
>
>     ###analyse de l'image
>     valeur = pytesseract.image_to_string(gray)
>     print(valeur)
>
>     ##passage en noir et blanc
>     (thresh, im_bw) = cv2.threshold(gray, 128, 255, cv2.THRESH_BINARY |
> cv2.THRESH_OTSU)
>     im_bw = cv2.bitwise_not(im_bw)
>     #cv2.imshow('Img',im_bw)
>     #cv2.waitKey(0)
>     # cv2.imwrite('ph.png',im_bw)
>     print(pytesseract.image_to_string(im_bw))
>
>
> ###ouverture de l'image
> img = cv2.imread('ocr5.png')
> # cv2.imshow('Img',imgcoupee)
>
>
> ###on rogne
> imgcoupee = img[1056:1517,950:1862]
> #img = cv2.imwrite('ocrcoupee.png',imgcoupee)
> # cv2.imshow('Img',imgcoupee)
>
> ### decoupage de la partie correspondant au PH
> ph= img[516:625, 616:815]
>
> #cv2.imwrite('pH.jpg', image_pH)
>
> ### partie chlore
> cl = img[516:625, 882:1056]
>
> ### partie dÃ:copyright:faut flow
> #flow= img[1302:1398,1054:1400]
>
> ### process
> #process_image(imgcoupee)
> process_image(ph)
> process_image(cl)
> #process_image(flow)
>
> digits seems to be clear enough, but it does'nt work, if someone could
> help me ?
>
> thanks !
>
> --
> You received this message because you are subscribed to the Google Groups
> "tesseract-ocr" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/tesseract-ocr/a05712a5-e6ed-411f-a072-e389ea7095efn%40googlegroups.com
> <https://groups.google.com/d/msgid/tesseract-ocr/a05712a5-e6ed-411f-a072-e389ea7095efn%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"tesseract-ocr" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tesseract-ocr/CAJbzG8x-JijWc-AS4SHQw7y2vR%3D4he0661%2BBTaf7XGYoh6c7oA%40mail.gmail.com.

Reply via email to