File tree 2 files changed +24
-8
lines changed
2 files changed +24
-8
lines changed Original file line number Diff line number Diff line change @@ -40,12 +40,32 @@ bool FCOORD::normalise() { // Convert to unit vec
40
40
return true ;
41
41
}
42
42
43
+ // Deserialize an ICOORD.
44
+ // For compatibility reasons it uses unsigned 16 bit coordinates
45
+ // instead of 32 bit coordinates.
43
46
bool ICOORD::DeSerialize (TFile *f) {
44
- return f->DeSerialize (&xcoord) && f->DeSerialize (&ycoord);
47
+ bool success = false ;
48
+ uint16_t coord;
49
+ if (f->DeSerialize (&coord)) {
50
+ xcoord = coord;
51
+ if (f->DeSerialize (&coord)) {
52
+ ycoord = coord;
53
+ success = true ;
54
+ }
55
+ }
56
+ return success;
45
57
}
46
58
59
+ // Serialize an ICOORD.
60
+ // For compatibility reasons it uses unsigned 16 bit coordinates
61
+ // instead of 32 bit coordinates.
47
62
bool ICOORD::Serialize (TFile *f) const {
48
- return f->Serialize (&xcoord) && f->Serialize (&ycoord);
63
+ uint16_t coord;
64
+ coord = xcoord;
65
+ auto success = f->Serialize (&coord);
66
+ coord = ycoord;
67
+ success = success && f->Serialize (&coord);
68
+ return success;
49
69
}
50
70
51
71
// Set from the given x,y, shrinking the vector to fit if needed.
Original file line number Diff line number Diff line change @@ -209,12 +209,8 @@ void assign_blobs_to_blocks2(Image pix,
209
209
**********************************************************************/
210
210
211
211
void Textord::find_components (Image pix, BLOCK_LIST *blocks, TO_BLOCK_LIST *to_blocks) {
212
- int width = pixGetWidth (pix);
213
- int height = pixGetHeight (pix);
214
- if (width > INT16_MAX || height > INT16_MAX) {
215
- tprintf (" Input image too large! (%d, %d)\n " , width, height);
216
- return ; // Can't handle it.
217
- }
212
+ auto width = pixGetWidth (pix);
213
+ auto height = pixGetHeight (pix);
218
214
219
215
BLOCK_IT block_it (blocks); // iterator
220
216
for (block_it.mark_cycle_pt (); !block_it.cycled_list (); block_it.forward ()) {
You can’t perform that action at this time.
0 commit comments