Created
August 15, 2012 01:40
-
-
Save shwangdev/3354620 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <baseapi.h> | |
#include <iostream> | |
#include <allheaders.h> | |
Pix *pix; | |
int offset; | |
float slope; | |
int main(int argc, char *argv[]) { | |
tesseract::TessBaseAPI api; | |
pix = pixRead(argv[1]); | |
api.Init(NULL, "eng"); | |
api.SetPageSegMode(tesseract::PSM_AUTO); | |
api.SetImage(pix); | |
char* outText = api.GetUTF8Text(); | |
int conf = api.MeanTextConf(); | |
api.GetTextDirection(&offset, &slope); | |
printf("Confidence=%d\n", conf); | |
printf("Offset: %d Slope: %.2f\n", offset, slope); | |
printf("OCR output:\n\n"); | |
printf(outText); | |
api.Clear(); | |
api.End(); | |
delete [] outText; | |
pixDestroy(&pix); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment