mirror of
https://github.com/qurator-spk/eynollah.git
synced 2026-08-03 01:12:46 +02:00
return_deskew_slop: pass refined angles, not sigma_des, on landscape main page
Signed-off-by: Sai Asish Y <say.apm35@gmail.com>
This commit is contained in:
parent
88ca39dedb
commit
42d383920d
2 changed files with 13 additions and 1 deletions
|
|
@ -1451,7 +1451,7 @@ def return_deskew_slop(img,
|
||||||
angle, _ = best_angle(angles)
|
angle, _ = best_angle(angles)
|
||||||
|
|
||||||
angles = np.linspace(angle - 22.5, angle + 22.5, n_tot_angles)
|
angles = np.linspace(angle - 22.5, angle + 22.5, n_tot_angles)
|
||||||
angle, _ = best_angle(sigma_des)
|
angle, _ = best_angle(angles)
|
||||||
elif main_page:
|
elif main_page:
|
||||||
#angles = np.linspace(-12, 12, n_tot_angles)#np.array([0 , 45 , 90 , -45])
|
#angles = np.linspace(-12, 12, n_tot_angles)#np.array([0 , 45 , 90 , -45])
|
||||||
angles = np.concatenate((np.linspace(-12, -7, n_tot_angles // 4),
|
angles = np.concatenate((np.linspace(-12, -7, n_tot_angles // 4),
|
||||||
|
|
|
||||||
12
tests/test_deskew.py
Normal file
12
tests/test_deskew.py
Normal file
|
|
@ -0,0 +1,12 @@
|
||||||
|
import numpy as np
|
||||||
|
|
||||||
|
from eynollah.utils.separate_lines import return_deskew_slop
|
||||||
|
|
||||||
|
def test_deskew_landscape_main_page():
|
||||||
|
# landscape page (width > height) used to crash with
|
||||||
|
# "TypeError: 'int' object is not iterable" (#223)
|
||||||
|
img = np.zeros((80, 160))
|
||||||
|
for y in (20, 40, 60):
|
||||||
|
img[y:y + 3, 10:150] = 1
|
||||||
|
angle = return_deskew_slop(img, 2, n_tot_angles=10, main_page=True)
|
||||||
|
assert np.isfinite(angle)
|
||||||
Loading…
Add table
Add a link
Reference in a new issue