-
Notifications
You must be signed in to change notification settings - Fork 9.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Warning. Invalid resolution 0 dpi. Using 70 instead. #1702
Comments
It means your image does not contain a resolution info in its metadata, so Tesseract warns you about this issue in the image and it tries to estimate the resolution by itself. |
@amitdo In which way? |
tesseract/src/ccmain/pagesegmain.cpp Line 313 in 2645f72
By measuring lines height. |
@zdenop I think, you can close this topic |
This comment was marked as off-topic.
This comment was marked as off-topic.
Tesseract uses Leptonica which uses libpng to read the input image source resolution. |
To test if an image has the correct header you can use and make sure these 2 values are set |
@lloiodice The version I am using is 3.05.02 and I can't find the function you said. |
How did you manage that Tesseract could read the input image from a URL? |
There is an undocumented command line option. Try using |
@bhasinnaik : your input image has no information about dpi. If you want to avoid warning, you should fix it. |
@zdenop , any idea how to fix the photo's DPI when it is 0? |
What did you try with imagemagick? Show your command ;-) |
|
Just very easy and short internet search suggest this modification: |
Thank you. I already tried that :-D , but still get the same tesseract error. Probably it is because of my image. |
I tried it and it works for my image.jpg. If you are using tesseract >=4 you can use --dpi option of tesseract executable. |
Try 300x300 with the mogrify command.
…On Fri, Oct 18, 2019, 10:02 AM zdenop ***@***.***> wrote:
I tried it and it works for my image.jpg. If you are using tesseract >=4
you can use --dpi option of tesseract executable.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#1702?email_source=notifications&email_token=ABF3NJXAR7FBSXBYDSVQN7LQPHT3JA5CNFSM4FGUSYKKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEBVEZZI#issuecomment-543837413>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABF3NJUPTPMR4QZWDNUIDGTQPHT3JANCNFSM4FGUSYKA>
.
|
FYI In my test of tesseract 4.1 (trying to upgrade from 4.0) .. I get this warning often and In 4.0 setting the metadata in the PNG as described in my post above allowed the correct If anybody knows what PNG metadata fields are necessary to avoid the warning please |
so you have png that does not produce dpi warning with tesseact 4.0, but it produces warning in 4.1? |
It appears to be a problem with script detection tesseract dpi_issue.png out --psm 0 File: When using 300 dpi or with 4.0 I get detected script Han. In 4.1 I get Latin. |
interesting: I see file has dpi (118x118 in IrfanView). Even when I specify dpi for tesseract, I see warning message:
BTW:
so it seems like problem with generating your png(?) |
Signed-off-by: Stefan Weil <[email protected]>
That's a bug in Tesseract. Tesseract internally creates a new image for that png file, but does not copy the resolution from the original image. Fixed now in commit a209a6b. |
@stweil : Thanks for looking into this. Funny that problem was with |
Signed-off-by: Stefan Weil <[email protected]>
I am using pytesseract and there are some images that work with the image_to_osd, but other images do not and the program gives me the following error: |
Please use the user forum for questions. |
After having an image of 300dpi , then also same error is coming mention below TesseractError: (3221225501, "read_params_file: Can't open txt Tesseract Open Source OCR Engine v4.1.1 with Leptonica Warning: Invalid resolution 0 dpi. Using 70 instead. Estimating resolution as 711") |
Hi @OmarJabri7, I am rotating the image with OpenCV and then passing it to pytesseract.image_to_osd() |
I've been using Tesseract for a while and got the same error. I just want to confirm that it is never about the metadata. I got the error while using image_to_osd for photos captured using the same device and this happened to only 3 of 50 images. I've checked the image details and the dpi already exists. I've been trying to see if the error disappears when I crop the background around the objects in the image, and I saw that the error disappeared for 2 of them, not all of them. I still don't really know the reason, but if it was the metadata, the third one would have worked. However, I believe that it has something related to the number of characters. The images that resulted in the error that disappeared after cropping were somewhat rotated. The text angle was around 30-40. Tesseract was giving me rotations of 90,180, and 270 only for the images that worked. When it comes to the image that gave error in both cases, it already has a low number of characters. This is why it would be interesting if more people try this so we can figure out if it's really the reason. |
Run this command on the original image: |
Please respect guidelines for posting issue: we do not provide support for 3rd party projects (I assume you use pytesseract based on image_to_osd). Also provide information about tesseract and leptonica version. |
Is there any way to set a default resolution in the event of |
That is not directly supported by Tesseract, but could be implemented by a wrapper script. The current Tesseract release 5.0.0 tries to guess the correct resolution if there is no explicit information from the image file. |
Most of the images I need to process are macOS screenshots – which are all PNG @ 144 DPI – and none of which tesseract recgonizes as having a DPI. Bummer. (Furthermore, to process well I have to set |
I tested some macOS screenshots, and Tesseract 5.0.0 worked well without the need to give a resolution. But you are free to add |
command
tesseract https://image.ibb.co/eibzaT/test.png result
Current Behavior:
version
original image https://image.ibb.co/eibzaT/test.png
The text was updated successfully, but these errors were encountered: