i am trying to convert a text image into text. I am using pytesser in python for that I have already installed tesseract but on running even the following code:
from pytesser import *
im = Image.open('phototest.tif')
text = image_to_string(im)
print text
I get the following error:
Tesseract Open Source OCR Engine with Leptonica
Please call SetImage before attempting recognition.
and nothing gets printed nothing (no result).
Any help on the above problem?
Try converting your image to another format and see if you have the same issue. I had this same problem using Tesseract form the command line. I had a bmp file, I saved the files in my pre processing to png and tesseract worked fine.
As an alternative, you can use pytesseract, which will automatically convert your image and process it correctly.
Related
enter image description here
this is the error that i have been getting
FileNotFoundError: No such file: '/home/jovyan/Downloads/filename.jpg'
i am trying to open and show an image using scikit image library but it hasnt been working
I guess you made mistake.
do it this way.
r'/home/jovyan/Downloads/filename.jpg'
Put the character 'r' at the beginning of the root directory.
I have been reading the forums and I have not found a solution to my problem.
Right now I have tried to read this image with tesseract library, but even in the CMD it says "Empty page!!"
I also believe that tesseract is not the best option since I will need this to be compiled into an .exe and the script with tesseract contains one static folder (the tesseract's one).
This is the code I was using to get teseract image:
# Set the path to the Tesseract executable
pytesseract.pytesseract.tesseract_cmd = 'C:\\Program Files\\Tesseract-OCR\\tesseract.exe'
# Locate the element containing the captcha image
captcha_img = driver.find_element(By.XPATH, '//*[#id="captchaImage"]')
# Take a screenshot of the element and save it to a file
captcha_img.screenshot('captcha.png')
# Open the image file and extract the text using Tesseract OCR
text = pytesseract.image_to_string(Image.open('captcha.png'))
# Locate the input field for the captcha text
captcha_input = driver.find_element(By.XPATH, '//*[#id="resultCaptcha"]')
# Input the extracted text into the field
captcha_input.send_keys(text)
This is an example of an image:
Any ideas on how to break the captcha and later get the .exe to work on other computers?
Thank you.
Tried to solve a captcha with tesseract but can't read the image.
Also I need the script to run without dependency of the tesseract main folder.
I'm using sikulix IDE version 2.0.5 in windows 10 and the usage so far is successful.
I want to read a specific single line text on the screen using sikulix IDE. I can't copy the text to the clipboard because it on an image.
I'm able to do this on eclipse IDE using Tesseract and tess4j in Java after I imported its jar.
With my project I'm looking to use sikulix IDE because I found it to be reliable in reading images.
My question now is how can I read the text on the screen presented as an image using sikulix IDE? Is there a method I can use within the sikuli IDE.
Can someone guide me!
Thank you.
text = Image.create("givenImage.png").text()
If you want to read from only part of the image:
text = Image.create("givenImage.png").getSub(x, y, w, h).text()
where x and y are counting from the top left corner of the image as (0, 0).
Example for top of image:
img = Image.create("givenImage.png")
text = img.getSub(0,0,img.w, 20).text()
RaiMan from SikuliX
I was writing a code to extract text from images using "pytesseract" library in Python. This is my code
text = pytesseract.image_to_string(Image.open("Figure_3.png"))
print(text)
fig, (ax1) = plt.subplots(1)
ax1.imshow("Figure3.png")
I just store the text in the image to a variable and display the original image.
I am getting the following error
TesseractNotFoundError: tesseract is not installed or it's not in your path
I have added Tesseract to my environment variable. I don't know where I have gone wrong. I don't have any problem in importing ass well.
This question already has answers here:
Tkinter error: Couldn't recognize data in image file
(11 answers)
Closed yesterday.
I have the following problem. I generate .GIF files using an external application.
To me the GIFs look fine, I can open them without problems.
However, using
photo = PhotoImage(file=screenshot_file)
self.previewImageLabel.config(image=photo)
self.previewImageLabel.image = photo
to add an image to a Tkinter Label, is giving me the following error:
TclError: couldn't recognize data in image file "C:\Users\D8W\Python\hoang\combi
ne_model_neu\test_bauteile\SQTR-VO\prev_F45_SQTR.GIF"
The thing is, when I upload one of the GIFs to some online Converter and convert them to "GIF", they get displayed perfectly fine.
So my external application, which generates the GIFs, is putting something in there that Tkinter doesn't like.
How can I modify the GIFs to work? What are alternatives solving this problem?
I may not use modules that are not included in Python(like PIL).
Do you have any ideas?
Thanks in advance
I solved it, the problem was within my external application. I specified the file as .GIF but I have set the type to PNG.
Thanks anyway