If you are really interested in help, than please post complete code of
your test case (+ how you compiled it)  including (link to) image you try
to process.

Zdenko


št 11. 10. 2018 o 12:39 Adam Richards <ajrichard...@gmail.com> napísal(a):

> Hi I am having issues with sending a Mat image the I have opened through
> OpenCV to Tesseract using the "SetImage" function.
> I can use Tesseract on the image when I just input the commented out bit
> at the end of the line as: SetImage(image);
>
> however when I run it as below the program will crash before even reaching
> this point and return to console "segmentation error"
>
> I have found this code as being identical to somebody who previously did
> my project, and i have no idea why this error is occurring.
>
>
> Please if somebody can help me or provide a working example of Tesseract
> using Mats from OpenCv I would greatly appreciate it.
>
> kind regards,
>
> Adam
>
>
> int main(int argc, char** argv )
> {
>
> imgOriginal = imread(argv[1],1);          // open image
> Mat img = imgOriginal;
>
> .........
>
>         namedWindow("img", WINDOW_NORMAL);
> imshow("img", img);
> waitKey(0);                 // hold window open until user presses a key
>
>     char *outText;
>     tesseract::TessBaseAPI *api = new tesseract::TessBaseAPI();
>     // Initialize tesseract-ocr with English, without specifying tessdata
> path
>     if (api->Init("/usr/share/tesseract-ocr", "eng")) {
>         fprintf(stderr, "Could not initialize tesseract.\n");
>         exit(1);
>     }
>
>     // Open input image with leptonica library
>     Pix *image =
> pixRead("/home/pi/opencv/sudoku_capture/sudoku2/Sudoku.jpg");
>     api->TesseractRect( img.data, 1, img.step1(), 0, 0, img.cols,
> img.rows);
>     api->SetImage((uchar*)img.data, img.size().width, img.size().height,
> img.channels(), img.step1());        //image);
>     api->Recognize(0);
>
>     // Get OCR result
>     outText = api->GetUTF8Text();
>     printf("OCR output:\n%s", outText);
>
>     // Destroy used object and release memory
>     api->End();
>     delete [] outText;
>     //pixDestroy(&image);
>
> --
> You received this message because you are subscribed to the Google Groups
> "tesseract-ocr" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to tesseract-ocr+unsubscr...@googlegroups.com.
> To post to this group, send email to tesseract-ocr@googlegroups.com.
> Visit this group at https://groups.google.com/group/tesseract-ocr.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/tesseract-ocr/5248e483-3f5c-4834-9c31-341b6873ffe5%40googlegroups.com
> <https://groups.google.com/d/msgid/tesseract-ocr/5248e483-3f5c-4834-9c31-341b6873ffe5%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"tesseract-ocr" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to tesseract-ocr+unsubscr...@googlegroups.com.
To post to this group, send email to tesseract-ocr@googlegroups.com.
Visit this group at https://groups.google.com/group/tesseract-ocr.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tesseract-ocr/CAJbzG8x7%3Da0kAs8b05pGyJ0%3D6q%2BU113-428Ow5D-d05gv-Wi9w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to