// Returns an Imagedata containing the image of the given box, // and ground truth boxes/truth text if available in the input. // The image is not normalized in any way. ImageData* Tesseract::GetLineData(const TBOX& line_box, const GenericVector<TBOX>& boxes, const GenericVector<STRING>& texts, int start_box, int end_box, const BLOCK& block) { TBOX revised_box; ImageData* image_data = GetRectImage(line_box, block, kImagePadding, &revised_box); if (image_data == NULL) return NULL; image_data->set_page_number(applybox_page); // Copy the boxes and shift them so they are relative to the image. FCOORD block_rotation(block.re_rotation().x(), -block.re_rotation().y()); ICOORD shift = -revised_box.botleft(); GenericVector<TBOX> line_boxes; GenericVector<STRING> line_texts; for (int b = start_box; b < end_box; ++b) { TBOX box = boxes[b]; box.rotate(block_rotation); box.move(shift); line_boxes.push_back(box); line_texts.push_back(texts[b]); } GenericVector<int> page_numbers; page_numbers.init_to_size(line_boxes.size(), applybox_page); image_data->AddBoxes(line_boxes, line_texts, page_numbers); return image_data; }