It looks like the pixRead function found the file "a.png" in C: \ datas, why does pixRead return a NULL value?
OS : Windows 10 pro
IDE tool : visual studio 2015 update 3
Teseract - ocr version link : https ://github.com/tesseract-ocr/tesseract (Tesseract Open Source OCR Engine(main repository))
leptonica version : 1.74.0
#include <allheaders.h>
#include <baseapi.h>
#include
int main()
{
char * outText = nullptr;
Pix *image = nullptr;
tesseract::TessBaseAPI *api = new tesseract::TessBaseAPI();
// Initialize tesseract-ocr with English, without specifying tessdata path
if (api->Init(NULL, "eng")) {
fprintf(stderr, "Could not initialize tesseract.\n");
exit(1);
}
image = pixRead("C:\\datas\\a.tif");
api->SetImage(image);
// Get OCR result
outText = api->GetUTF8Text();
printf("\n OCR output: %s \n", outText);
// Destroy used object and release memory
api->End();
delete[] outText;
pixDestroy(&image);
return 0;
}
Output:
/********************************************************************/
Error in pixReadStreamPng : function not present
Error in pixReadStream : no fix returned
Error in pixRead : pix not Read
Error in pixGetDimensions : pix not defined
Error in pixGetColormap : pix not defined
Error in pixGetCopy : Pixs not defined
Error in pixGetDepth : pix not defined
Error in pixGetWpl : pix not defined
Error in pixGetYRes : pix not defined
Error in pixGetClone : Pixs not defined
Please call SetImage before attempting recognition.
--
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+unsubscribe@googlegroups.com.
To post to this group, send email to tesser...@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/2afe5d49-c370-4d63-a54e-045ca04fcfb1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.