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
it is done
This message was deleted
Thiago Alessio Pereira
@thiagoalessio
and what was the result?
ShikhaPant
@ShikhaPant
The quick brown fox jumps over the lazy dog.
Thanks for your time
Thiago Alessio Pereira
@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
Thiago Alessio Pereira
@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
i am using this and stuck when upload in cpanel
can you please tell me the process of using this library in cpanel
igi-1w3r53n
@igi-1w3r53n
@JordanMalan thank you. My solution for testing purpose looks like this (I tested with imageick and imagecrop):
public function crop($pRectangle, $pPath, $pFilename, $pMethod = 1)
    {
        try
        {
            $srcPath = $pPath . DIRECTORY_SEPARATOR . $pFilename;
            $targetPath = $pPath . DIRECTORY_SEPARATOR . "demobill_cropped.png";

            if ($pMethod == 1)
            {
                $image = imagecreatefrompng($srcPath);
                $cropped = imagecrop($image, $pRectangle);

                imagepng($cropped, $targetPath);
                imagedestroy($image);

                $ocr = new TesseractOCR($targetPath);
                return $ocr->run();
            }
            elseif ($pMethod == 2)
            {
                if (!$this->imageick)
                {
                    $this->imageick = new Imagick(realpath($srcPath));
                    $this->bkp = $this->imageick->getImage();
                }

                $img = $this->bkp->clone();
                $img->cropImage($pRectangle['width'], $pRectangle['height'], $pRectangle['x'], $pRectangle['y']);
                $data = $img->getImageBlob();
                $size = $img->getImageLength();

                $ocr = new TesseractOCR();
                $ocr->imageData($data, $size);

                return $ocr->run();
            }
        }
        catch (\Exception $e)
        {
            return $e->getMessage();
        }
    }
Michael Bordash
@mbordash
Hi, I see you're using proc_open. I'd like to implement a max execution time function that kills the child unix process in case someone tries to scan a file and consumes too much CPU time. Any chance you have this in the works or know of a good way to handle this?
Jordan Malan
@JordanMalan
@mbordash I spent a few hours learning about processes and pipes, etc.. I made a script that worked. Then I looked at the library to see how I might implement it then found that it already existed :D hahahah
@mbordash You can pass a timeout (in milliseconds?) to run(). See https://github.com/thiagoalessio/tesseract-ocr-for-php#run
Jordan Malan
@JordanMalan
@mbordash I see your activity here and on the repo and I'm getting some context now. I'll do some research tonight and see if I can't reproduce and fix the issue. Can you specify a few more details about your configuration?
prodv
@prodv
Below errors are coming when I run ocrmypdf in CentOS 8.
    1 [tesseract] read_params_file: Can't open pdf                                                                                                                              
    1 [tesseract] read_params_file: Can't open txt

Command is ->

ocrmypdf image.pdf text.pdf

What to do ?