-
Notifications
You must be signed in to change notification settings - Fork 152
Empty image detection #64
Comments
Please keep in mind that Pyocr is just a wrapper for Tesseract and Cuneiform. Therefore, does Tesseract or Cuneiform provide such functionality ? |
That's why I stated If it's possible. I don't know if they provide API for that, but Tesseract prints to stdout |
I can't find any option related to what you are looking for. I doubt there is one. I think being able to tell there is no text implies that you must try to find text, which in turn implies running the full OCR process to be perfectly sure. I'm going to close this ticket. Feel free to comment here if you find such option, and I will reopen this ticket. |
BTW, are you looking to know if there is no text at all (only images, photos, etc), or if the input image is actually empty ? |
I want to know if there is a text or not. If I wanted to know, whether an image is entirely empty, I would go for Google Cloud Vision for sure. Also, Google Cloud Vision can do something close to what I want, and it's that you can limit number of detected text annotations. But it still returns way more data than I need and it's kind of expensive for just saying whether there is a text or not. |
I've been playing around with Tesseract CLI and just found out it returns Script and Script confidence in OSD-only PSM. Using this feature seems to be ~36x faster than using mode 3 on a image with ~12,000 characters (2.4 instead of 88.3 seconds). I see that these values are omitted in |
Oh good point, I forgot about this, my bad : |
Currently, it seems like the only way to detect whether an image is empty or not is using
image_to_string(...)
. However, this method is very inefficient on images containing thousands of characters or more. If it's possible, I'd be great to implement something likeis_image_empty(image)
, which would return abool
describing, whether the image is empty or not.The text was updated successfully, but these errors were encountered: