MCPcopy Create free account
hub / github.com/creatale/node-dv / ReadAllBoxes

Function ReadAllBoxes

deps/tesseract/ccstruct/boxread.cpp:50–62  ·  view source on GitHub ↗

Reads all boxes from the given filename. Reads a specific target_page number if >= 0, or all pages otherwise. Skips blanks if skip_blanks is true. The UTF-8 label of the box is put in texts, and the full box definition as a string is put in box_texts, with the corresponding page number in pages. Each of the output vectors is optional (may be NULL). Returns false if no boxes are found.

Source from the content-addressed store, hash-verified

48// Each of the output vectors is optional (may be NULL).
49// Returns false if no boxes are found.
50bool ReadAllBoxes(int target_page, bool skip_blanks, const STRING& filename,
51 GenericVector<TBOX>* boxes,
52 GenericVector<STRING>* texts,
53 GenericVector<STRING>* box_texts,
54 GenericVector<int>* pages) {
55 GenericVector<char> box_data;
56 if (!tesseract::LoadDataFromFile(BoxFileName(filename), &box_data))
57 return false;
58 // Convert the array of bytes to a string, so it can be used by the parser.
59 box_data.push_back('\0');
60 return ReadMemBoxes(target_page, skip_blanks, &box_data[0], boxes, texts,
61 box_texts, pages);
62}
63
64// Reads all boxes from the string. Otherwise, as ReadAllBoxes.
65bool ReadMemBoxes(int target_page, bool skip_blanks, const char* box_data,

Callers 1

ApplyBoxesMethod · 0.85

Calls 4

LoadDataFromFileFunction · 0.85
BoxFileNameFunction · 0.85
ReadMemBoxesFunction · 0.85
push_backMethod · 0.45

Tested by

no test coverage detected