I am stuck with following error:
--> Thread 1: EXC_BAD_ACCESS (code=1, address=0x0)
In this particular line of code:
-->
outText = string(ocr->GetUTF8Text());
Here is the complete code:
// OCR Process Begins
string outText;
string imPath = argv[2];
// Create Tesseract object
tesseract::TessBaseAPI *ocr = new tesseract::TessBaseAPI();
// Initialize tesseract to use English (eng) and the LSTM OCR engine.
ocr->Init(NULL, "eng", tesseract::OEM_LSTM_ONLY);
// Set Page segmentation mode to PSM_AUTO (3)
ocr->SetPageSegMode(tesseract::PSM_AUTO);
// Open input image using OpenCV
Mat im = cv::imread(imPath, IMREAD_COLOR);
// Set image data
ocr->SetImage(im.data, im.cols, im.rows, 3, static_cast<int>(im.step));
// Run Tesseract OCR on image
outText = string(ocr->GetUTF8Text());
// print recognized text
cout << outText << endl; // Destroy used object and release memory ocr->End();
waitKey();
//return 0 instead of return EXIT_SUCCESS
return EXIT_SUCCESS;
This is a list of errors I'm getting.
Error in pixCreateHeader: width must be > 0 Error in pixCreateNoInit: pixd not made Error in pixCreate: pixd not made Error in pixGetData: pix not defined Error in pixGetWpl: pix not defined Error in pixGetDimensions: pix not defined Error in pixGetColormap: pix not defined Error in pixCopy: pixs not defined Error in pixGetDepth: pix not defined Error in pixGetWpl: pix not defined Error in pixGetYRes: pix not defined Error in pixClone: pixs not defined Please call SetImage before attempting recognition. (lldb)
Thanks in advance