Commit ebd82354 authored by Philipp Zumstein's avatar Philipp Zumstein Committed by GitHub
Browse files

Merge pull request #252 from jze/gpageseg

Fix regression in ocropus-gpageseg #251
parents d823ba4f c74d2be3
......@@ -106,7 +106,11 @@ parser.add_argument('files',nargs='+')
args = parser.parse_args()
args.files = ocrolib.glob_all(args.files)
def find(condition):
"Return the indices where ravel(condition) is true"
res, = np.nonzero(np.ravel(condition))
return res
def norm_max(v):
return v/np.amax(v)
......@@ -302,7 +306,7 @@ def compute_line_seeds(binary,bottom,top,colseps,scale):
seeds = np.zeros(binary.shape,'i')
delta = max(3,int(scale/2))
for x in range(bmarked.shape[1]):
transitions = sorted([(y,1) for y in np.where(bmarked[:,x])[0]]+[(y,0) for y in np.where(tmarked[:,x][0])])[::-1]
transitions = sorted([(y,1) for y in find(bmarked[:,x])]+[(y,0) for y in find(tmarked[:,x])])[::-1]
transitions += [(0,0)]
for l in range(len(transitions)-1):
y0,s0 = transitions[l]
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment