@@ -479,8 +479,8 @@ def image_from_page(self, page, page_id,
479
479
[page_xywh ['w' ], page_xywh ['h' ]], skew )
480
480
# FIXME we should enforce consistency here (i.e. rotation always reshapes,
481
481
# and rescaling never happens)
482
- if not (w_new - 1.5 < page_image .width < w_new + 1.5 and
483
- h_new - 1.5 < page_image .height < h_new + 1.5 ):
482
+ if not (w_new - 2 < page_image .width < w_new + 2 and
483
+ h_new - 2 < page_image .height < h_new + 2 ):
484
484
log .error ('page "%s" image (%s; %dx%d) has not been reshaped properly (%dx%d) during rotation' ,
485
485
page_id , page_coords ['features' ],
486
486
page_image .width , page_image .height ,
@@ -741,15 +741,16 @@ def image_from_segment(self, segment, parent_image, parent_coords,
741
741
# and rescaling never happens)
742
742
w_new , h_new = adjust_canvas_to_rotation (
743
743
[segment_xywh ['w' ], segment_xywh ['h' ]], skew )
744
- if not (w_new - 1.5 < segment_image .width < w_new + 1.5 and
745
- h_new - 1.5 < segment_image .height < h_new + 1.5 ):
744
+ if not (w_new - 2 < segment_image .width < w_new + 2 and
745
+ h_new - 2 < segment_image .height < h_new + 2 ):
746
746
log .error ('segment "%s" image (%s; %dx%d) has not been reshaped properly (%dx%d) during rotation' ,
747
747
segment .id , segment_coords ['features' ],
748
748
segment_image .width , segment_image .height ,
749
749
w_new , h_new )
750
750
else :
751
- if not (segment_xywh ['w' ] - 1.5 < segment_image .width < segment_xywh ['w' ] + 1.5 and
752
- segment_xywh ['h' ] - 1.5 < segment_image .height < segment_xywh ['h' ] + 1.5 ):
751
+ # FIXME: currently unavoidable with line-level dewarping (which increases height)
752
+ if not (segment_xywh ['w' ] - 2 < segment_image .width < segment_xywh ['w' ] + 2 and
753
+ segment_xywh ['h' ] - 2 < segment_image .height < segment_xywh ['h' ] + 2 ):
753
754
log .error ('segment "%s" image (%s; %dx%d) has not been cropped properly (%dx%d)' ,
754
755
segment .id , segment_coords ['features' ],
755
756
segment_image .width , segment_image .height ,
0 commit comments