Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Quick Tesseract test
/* Results for image
This book was chiefly intended for English (and American)
readers. Those points are emphasised which in the judgment of
the author required emphasis for such readers. It may be worth
while, therefore, in preparing a French translation, to indicate
quite frankly and in a few words one or two of those aspects of
the situation arising out of the Treaty of Versailles, which are of
special significance for France.
The following chapters are designed to show, amongst other
things, that our representatives at the Paris conference committed
two grand errors against our interests. By demanding the impos-
sible, they forsook the substance for the shadow and will in the
event lose everything. By excessive concentration on political
objects and on the attainment of an illusory security, they over-
looked the economic unity of Europe——illusory because security
is to be found least of all in the occupation of extended frontiers,
and also because the political contrivances of the moment will be
largely irrelevant to the problems of a later decade.
Let me say over again but more emphatically what is said in
the following pages as to the hearing of these errors on the
fortunes of France.
By the triumphantly victorious issue of the war, the political
and moral position of France was no longer in question. But her
financial and economic prospects were very bad. It was these
latter, therefore, which prudent statesmanship should have
sought to secure in the peace. French interests surely demanded
most of all that she should obtain a reasonable priority out of
such sums as Germany might prove able to pay, that her too
heavy debts to her allies should be regulated, and that having
herself shown towards the enemy some measure of magnanimity,
she should be in a position to expect it in return and to share
moderately, and in proportion to her needs, in such reconstruc-
I From English original in Keynes‘: handwriting among Ill: i<.y..e. papers {ca}.
University Publishing Online, hosted by Cambridge University Press © 2011
// Requires tesseract and leptonica
// Make with: g++ test.cpp -llept -ltesseract
#include <tesseract/baseapi.h>
#include <leptonica/allheaders.h>
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");
// Open input image with leptonica library
Pix *image = pixRead("/home/cwoodall/scratch/tesstest/test.jpg");
// Get OCR result
outText = api->GetUTF8Text();
printf("OCR output:\n%s", outText);
// Destroy used object and release memory
delete [] outText;
return 0;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.