Stack Overflow на русском Asked on November 13, 2021
Программа ругается на delete api; Код взят от сюда. Пишет Программа вызвал срабатывание точки останова.
#include <stdio.h>
#include <tchar.h>
#include <iostream>
#include <fstream>
//include tesseract headers
#include <baseapi.h>
#include <allheaders.h>
using namespace std;
int main()
{
char* outText;
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);
}
// Open input image with leptonica library
Pix* image = pixRead("/usr/src/tesseract/testing/phototest.tif");
api->SetImage(image);
// Get OCR result
outText = api->GetUTF8Text();
printf("OCR output:n%s", outText);
// Destroy used object and release memory
api->End();
delete api;
delete[] outText;
pixDestroy(&image);
return 0;
}
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP