The code ! I hope it will help.
Le lun. 26 févr. 2024 à 17:56, Will Fetherolf <[email protected]> a
écrit :
> That helps a lot. Sure, please send me the code.
>
> On Saturday, February 24, 2024 at 12:00:35 PM UTC-6 [email protected]
> wrote:
>
>> I use 3 filtering : convert to gray scales - inverted image and last
>> one cv2.threshold(self.img1,127,255, cv2.THRESH_BINARY)
>> Does it help ? I can send you the python cv2 code
>>
>> Le ven. 23 févr. 2024 à 22:56, Will Fetherolf <[email protected]> a
>> écrit :
>>
>>> Do you know what threshold was used to convert the color to black on
>>> white?
>>> I'm doing these operations through a home-grown automated test system,
>>> and I can convert the image to black and white on the fly.
>>>
>>> On Friday, February 23, 2024 at 5:04:27 AM UTC-6 [email protected]
>>> wrote:
>>>
>>>> I transform your image as a real Black and white image and it works
>>>> well.
>>>> -l eng --psm 6 '
>>>>
>>>> Le ven. 23 févr. 2024 à 06:49, Will Fetherolf <[email protected]> a
>>>> écrit :
>>>>
>>>>> All,
>>>>>
>>>>> I need some help extracting the text from this image. I'm using the
>>>>> command line version of Tesseract from UBMannheim. I think it's 5.2
>>>>> installed. I've tried every PSM, and nothing seems to pull it out. If I
>>>>> crop off the minus sign, it works perfectly.
>>>>>
>>>>> Any tips at all would be appreciated.
>>>>>
>>>>> TIA!
>>>>> Will
>>>>>
>>>>> --
>>>>> 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/58b76c0b-2d6f-4574-a9e8-24d1a7dcc3d9n%40googlegroups.com
>>>>> <https://groups.google.com/d/msgid/tesseract-ocr/58b76c0b-2d6f-4574-a9e8-24d1a7dcc3d9n%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/10608a37-af71-404c-9f3d-4526ab115a19n%40googlegroups.com
>>> <https://groups.google.com/d/msgid/tesseract-ocr/10608a37-af71-404c-9f3d-4526ab115a19n%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/706e03ab-45c5-4b3c-881e-3d5e8915062an%40googlegroups.com
> <https://groups.google.com/d/msgid/tesseract-ocr/706e03ab-45c5-4b3c-881e-3d5e8915062an%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/CAPJAo_qapMH8sUV-xTWNYmesEW%3Dfs0Bb2dY%3D_g39T6wyJ56SVQ%40mail.gmail.com.
import cv2
import pytesseract as tesser
originalImage = cv2.imread('img.bmp') #original image
grayImage = cv2.cvtColor(originalImage, cv2.COLOR_BGR2GRAY) #image to gray
imginverse = cv2.bitwise_not(grayImage) #inverted image
(thresh, imgbw) = cv2.threshold(imginverse,127,255, cv2.THRESH_BINARY) # black and white
cv2.imshow('Original image',originalImage)
cv2.imshow('Gray image', grayImage)
cv2.imshow('Inverted image', imginverse)
cv2.imshow('Black white image', imgbw)
cv2.waitKey(0) #make enter
cv2.destroyAllWindows()
#tesseract transformation
#
custom_config = r' -l ' + 'eng' + ' --psm 6 '
tesser.pytesseract.tesseract_cmd=r'c:\Program Files\Tesseract-OCR\tesseract.exe' #tesseract exec under windows
text= tesser.image_to_string(imgbw,config=custom_config ) #here we go imgbw 2 text
#the result is also good with the imginverse
print(text) #the text