mirror of
https://github.com/tesseract-ocr/tesseract.git
synced 2024-11-27 12:49:35 +08:00
Support image width and height larger than 32767
Builds now can define LARGE_IMAGES to use 32 bit for image dimensions instead of 16 bit. Signed-off-by: Stefan Weil <sw@weilnetz.de>
This commit is contained in:
parent
ecf0622a85
commit
6583659806
@ -40,12 +40,32 @@ bool FCOORD::normalise() { // Convert to unit vec
|
||||
return true;
|
||||
}
|
||||
|
||||
// Deserialize an ICOORD.
|
||||
// For compatibility reasons it uses unsigned 16 bit coordinates
|
||||
// instead of 32 bit coordinates.
|
||||
bool ICOORD::DeSerialize(TFile *f) {
|
||||
return f->DeSerialize(&xcoord) && f->DeSerialize(&ycoord);
|
||||
bool success = false;
|
||||
uint16_t coord;
|
||||
if (f->DeSerialize(&coord)) {
|
||||
xcoord = coord;
|
||||
if (f->DeSerialize(&coord)) {
|
||||
ycoord = coord;
|
||||
success = true;
|
||||
}
|
||||
}
|
||||
return success;
|
||||
}
|
||||
|
||||
// Serialize an ICOORD.
|
||||
// For compatibility reasons it uses unsigned 16 bit coordinates
|
||||
// instead of 32 bit coordinates.
|
||||
bool ICOORD::Serialize(TFile *f) const {
|
||||
return f->Serialize(&xcoord) && f->Serialize(&ycoord);
|
||||
uint16_t coord;
|
||||
coord = xcoord;
|
||||
auto success = f->Serialize(&coord);
|
||||
coord = ycoord;
|
||||
success = success && f->Serialize(&coord);
|
||||
return success;
|
||||
}
|
||||
|
||||
// Set from the given x,y, shrinking the vector to fit if needed.
|
||||
|
@ -209,12 +209,8 @@ void assign_blobs_to_blocks2(Image pix,
|
||||
**********************************************************************/
|
||||
|
||||
void Textord::find_components(Image pix, BLOCK_LIST *blocks, TO_BLOCK_LIST *to_blocks) {
|
||||
int width = pixGetWidth(pix);
|
||||
int height = pixGetHeight(pix);
|
||||
if (width > INT16_MAX || height > INT16_MAX) {
|
||||
tprintf("Input image too large! (%d, %d)\n", width, height);
|
||||
return; // Can't handle it.
|
||||
}
|
||||
auto width = pixGetWidth(pix);
|
||||
auto height = pixGetHeight(pix);
|
||||
|
||||
BLOCK_IT block_it(blocks); // iterator
|
||||
for (block_it.mark_cycle_pt(); !block_it.cycled_list(); block_it.forward()) {
|
||||
|
Loading…
Reference in New Issue
Block a user