|
@@ 651-666 (lines=16) @@
|
| 648 |
|
skew = 0 |
| 649 |
|
segment_coords['angle'] = parent_coords['angle'] # nothing applied yet (depends on filters) |
| 650 |
|
|
| 651 |
|
if (orientation and |
| 652 |
|
not 'rotated-%d' % orientation in feature_filter.split(',')): |
| 653 |
|
# Transpose in affine coordinate transform: |
| 654 |
|
# (consistent with image transposition or AlternativeImage below) |
| 655 |
|
transposition = { 90: Image.ROTATE_90, |
| 656 |
|
180: Image.ROTATE_180, |
| 657 |
|
270: Image.ROTATE_270 |
| 658 |
|
}.get(orientation) # no default |
| 659 |
|
segment_coords['transform'] = transpose_coordinates( |
| 660 |
|
segment_coords['transform'], |
| 661 |
|
transposition, |
| 662 |
|
np.array([0.5 * segment_xywh['w'], |
| 663 |
|
0.5 * segment_xywh['h']])) |
| 664 |
|
segment_xywh['w'], segment_xywh['h'] = adjust_canvas_to_transposition( |
| 665 |
|
[segment_xywh['w'], segment_xywh['h']], transposition) |
| 666 |
|
segment_coords['angle'] += orientation |
| 667 |
|
if (skew and |
| 668 |
|
not 'deskewed' in feature_filter.split(',')): |
| 669 |
|
# Rotate around center in affine coordinate transform: |
|
@@ 379-394 (lines=16) @@
|
| 376 |
|
log.debug("page '%s' has orientation=%d skew=%.2f", |
| 377 |
|
page_id, orientation, skew) |
| 378 |
|
|
| 379 |
|
if (orientation and |
| 380 |
|
not 'rotated-%d' % orientation in feature_filter.split(',')): |
| 381 |
|
# Transpose in affine coordinate transform: |
| 382 |
|
# (consistent with image transposition or AlternativeImage below) |
| 383 |
|
transposition = { 90: Image.ROTATE_90, |
| 384 |
|
180: Image.ROTATE_180, |
| 385 |
|
270: Image.ROTATE_270 |
| 386 |
|
}.get(orientation) # no default |
| 387 |
|
page_coords['transform'] = transpose_coordinates( |
| 388 |
|
page_coords['transform'], |
| 389 |
|
transposition, |
| 390 |
|
np.array([0.5 * page_xywh['w'], |
| 391 |
|
0.5 * page_xywh['h']])) |
| 392 |
|
page_xywh['w'], page_xywh['h'] = adjust_canvas_to_transposition( |
| 393 |
|
[page_xywh['w'], page_xywh['h']], transposition) |
| 394 |
|
page_coords['angle'] = orientation |
| 395 |
|
if (skew and |
| 396 |
|
not 'deskewed' in feature_filter.split(',')): |
| 397 |
|
# Rotate around center in affine coordinate transform: |