Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
ShikhaPant
@ShikhaPant

[root@ip204 ~]# cat /tmp/ocrBvznOC.txt
The quick brown fox
jumps over
the lazy dog.

[root@ip204 ~]#

thiagoalessio
@thiagoalessio
ok, so tesseract works fine in your system. the issue is when running PHP.
how are you running the PHP script? as root user on the command line, or through a web server?
ShikhaPant
@ShikhaPant
web server
thiagoalessio
@thiagoalessio
can you become the web server user and run the the following again:
$ "/usr/local/bin/tesseract" "text.png" "/tmp/ocrBvznOC"
$ cat "/tmp/ocrBvznOC.txt"
ShikhaPant
@ShikhaPant
ok
I have working under folder say abc but tesseract in install under /usr/local/bin/tesseract

and composer is also under abc folder

will it make any difference

and all the command you asked are working outside the folder on root
thiagoalessio
@thiagoalessio

hm, they are 2 different things ... it is normal to have the tesseract binary in /usr/local/bin ...
what i'm trying to find out is if the user running your webserver (nginx, apache, httpd) has permissions to see the image file, write on temp dir ...

so if you use nginx for example:

root # sudo su nginx -
nginx $ cd /var/www/abc
nginx $ php index.php
(it should spit out HTML with the output)
ShikhaPant
@ShikhaPant
it is done
This message was deleted
thiagoalessio
@thiagoalessio
and what was the result?
ShikhaPant
@ShikhaPant
The quick brown fox jumps over the lazy dog.
Thanks for your time
thiagoalessio
@thiagoalessio
no problem, does it work on the browser too ?
ShikhaPant
@ShikhaPant
can you please give me documentation where I can check and work with advance functionality
Yes working on the brower too
thiagoalessio
@thiagoalessio
the docs of this PHP wrapper are here: https://github.com/thiagoalessio/tesseract-ocr-for-php#api
but to know more about all the capabilities of tesseract itself: https://tesseract-ocr.github.io/tessdoc/
ShikhaPant
@ShikhaPant
OK thanks for your support will let you know when if need anything else
ShikhaPant
@ShikhaPant
hello
I am trying to print the following image
image.png
how can I do this
ShikhaPant
@ShikhaPant
image.png
If I am uplaoding handwritten text is not picking up can you please let me know the possible issue
ShikhaPant
@ShikhaPant
image.png

and when I uploaded this image by using the adding the text using the text editor online it give me following error

Fatal error: Uncaught thiagoalessio\TesseractOCR\UnsuccessfulCommandException: Error! The command did not produce any output.

Generated command:
"/usr/local/bin/tesseract" "images/signature.png" "/tmp/ocrjUWT6V"

Returned message:
Tesseract Open Source OCR Engine v3.04.01 with Leptonica
Empty page!!
Empty page!! in /home/shinedez/public_html/OCR/vendor/thiagoalessio/tesseract_ocr/src/FriendlyErrors.php:74
Stack trace:

#0 /home/shinedez/public_html/OCR/vendor/thiagoalessio/tesseract_ocr/src/TesseractOCR.php(39): thiagoalessio\TesseractOCR\FriendlyErrors::checkCommandExecution()

#1 /home/shinedez/public_html/OCR/upload.php(28): thiagoalessio\TesseractOCR\TesseractOCR->run()

#2 {main}

thrown in /home/shinedez/public_html/OCR/vendor/thiagoalessio/tesseract_ocr/src/FriendlyErrors.php on line 74

Michael Bordash
@mbordash
Hi, we have a light weight dockerized microservice that accepts image OCR scan requests using your library. On occasion, we see zombie tesseract processes lingering and taking up resources. Almost as if php exec gives up, and the tesseract process continues ad infinitum. Can you recommend core PHP tuning/configuration options that might address this behavior? We're not seeing any errors in logs that point to a definite root cause.
4 replies
thomasanna
@thomasanna
Fatal error: Uncaught thiagoalessio\TesseractOCR\FeatureNotAvailableException: Error! Reading image data from stdin is not available this tesseract version Required version is 3.03-rc1, actual version is is Generated command: "tesseract" "" "C:\Users\hp\AppData\Local\Temp\ocr49E1.tmp" in C:\xampp\htdocs\v34\osincludes\ocr\vendor\thiagoalessio\tesseract_ocr\src\FriendlyErrors.php:108 Stack trace: #0 C:\xampp\htdocs\v34\osincludes\ocr\vendor\thiagoalessio\tesseract_ocr\src\TesseractOCR.php(63): thiagoalessio\TesseractOCR\FriendlyErrors::checkTesseractVersion('3.03-rc1', 'Reading image d...', Object(thiagoalessio\TesseractOCR\Command)) #1 C:\xampp\htdocs\v34\ocr.php(361): thiagoalessio\TesseractOCR\TesseractOCR->imageData('<br />\n<b>Warni...', 148) #2 {main} thrown in C:\xampp\htdocs\v34\osincludes\ocr\vendor\thiagoalessio\tesseract_ocr\src\FriendlyErrors.php on line 108
1 reply
Akshay Sonawane
@akkiraje212:matrix.org
[m]

I got this error, Please help me.

code
require_once "vendor/autoload.php";

echo (new TesseractOCR($file_name))->run();

xiaohui
@xiaohui96
image.png
hello , i am using tesseract-ocr-for-php in win10, and it's version is 3.05.00dev. It works well. However, when i use the api of userWords, it doesn't work, and IDEA reminds me that 'Method 'userWords' not found in thiagoalessio\TesseractOCR\TesseractOCR Reference method is not found in subject class'. can anyone help me, thanks a lot
image.png
This is the whole code screenshot
Tal Lahyani
@talah221
method userWords also doesn't exists for me too.
also the package not reading all file, what can I do
Satyabrata Panigrahi
@satyantspl:matrix.org
[m]
Fatal error: Cannot use thiagoalessio\TesseractOCR\TesseractOCR as TesseractOCR because the name is already in use in C:\xampp\htdocs\test\pdfsearch.php on line 14 i am getting error
Harsha-Karbotkar
@Harsha-Karbotkar

Hi,
Getting below error on
echo (new TesseractOCR('sample01.jpg'))
->run();
Fatal error: Uncaught exception 'thiagoalessio\TesseractOCR\TesseractNotFoundException' with message 'Error! The command "tesseract" was not found. Make sure you have Tesseract OCR installed on your system: https://github.com/tesseract-ocr/tesseract The current $PATH is C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files\Git\cmd;C:\Program Files\PuTTY\;C:\xampp\php;D:\xampp;C:\Program Files\MySQL\MySQL Shell 8.0\bin\;C:\Users\Harsha\AppData\Local\Microsoft\WindowsApps;C:\Users\Harsha\AppData\Local\Programs\Microsoft VS Code\bin;C:\Users\Harsha\AppData\Local\Microsoft\WindowsApps;C:\Users\Harsha\AppData\Roaming\Composer\vendor\bin' in C:\xampp\htdocs\Test\vendor\thiagoalessio\tesseract_ocr\src\FriendlyErrors.php:40 Stack trace: #0 C:\xampp\htdocs\Test\vendor\thiagoalessio\tesseract_ocr\src\TesseractOCR.php(26): thiagoalessio\TesseractOCR\FriendlyErrors::checkTesseractPresence('tesseract') #1 C:\xampp\htdocs\Test\test.php(13 in C:\xampp\htdocs\Test\vendor\thiagoalessio\tesseract_ocr\src\FriendlyErrors.php on line 40

Please help

gme777
@gme777
Hi

PHP Fatal error: Uncaught thiagoalessio\TesseractOCR\UnsuccessfulCommandException: Error! The command did not produce any output.

Generated command:
"tesseract" "txtimg.png" "/tmp/ocrg5okNs"

Returned message:
Tesseract Open Source OCR Engine v3.04.01 with Leptonica
Info in pixReadStreamPng: converting (cmap + alpha) ==> RGBA
Error in pixReadStreamPng: spp == 1, cmap, trans array, invalid depth: 4 in /var/www/html/st_scraper/vendor/thiagoalessio/tesseract_ocr/src/FriendlyErrors.php:66
Stack trace:

#0 /var/www/html/st_scraper/vendor/thiagoalessio/tesseract_ocr/src/TesseractOCR.php(39): thiagoalessio\TesseractOCR\FriendlyErrors::checkCommandExecution(Object(thiagoalessio\TesseractOCR\Command), '', 'Tesseract Open ...')

#1 /var/www/html/st_scraper/ocr.php(7): thiagoalessio\TesseractOCR\TesseractOCR->run()

#2 {main}

thrown in /var/www/html/st_scraper/vendor/thiagoalessio/tesseract_ocr/src/FriendlyErrors.php on line 66

do someone know how i can fix that
the php file:
<?php
require_once "vendor/autoload.php";
use thiagoalessio\TesseractOCR\TesseractOCR;
echo (new TesseractOCR('txtimg.png'))
    ->run();
igi-1w3r53n
@igi-1w3r53n
Hi, and thank you so much for this great repository! The origin tesseract module / API has a function to crop parts of an image to detect the text in a specific area (api->SetRectangle(30, 86, 590, 100)). Unfortunately, this repository has no function like “SetRectangle” or “setRectangle”. Is there a way to define areas that the tool should read? I need to define multiple parts in an image to create an assignment to the different input values.
Jordan Malan
@JordanMalan
@gme777 It seems the library isn't able to run any commands, do you have tesseract installed? Is it available via your environment's PATH variable?
@igi-iwersen In the past I've used imagick to crop parts of an image then OCR those individual parts, imagick also came in handy when I was converting from PDF to PNG. Perhaps this is something you could try?
@thiagoalessio Hi, I'm not super familiar with tesseract itself but I have used this library in the past (I even fixed a bug a while ago haha) -- I'm wondering if tesseract has the capability to export coordinates of text and if it's possible for me to use or extend the php library to extract those coordinates?
Kaisir Ahmed Oly
@kaisirerp2all
i am new for tesseract-ocr library