Permalink
Browse files

Merge pull request #252 from jze/gpageseg

Fix regression in ocropus-gpageseg #251
  • Loading branch information...
zuphilip committed Oct 17, 2017
2 parents d823ba4 + c74d2be commit ebd82354f08c54912a3261e4428b35849cf45f95
Showing with 6 additions and 2 deletions.
  1. +6 −2 ocropus-gpageseg
View
@@ -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]

0 comments on commit ebd8235

Please sign in to comment.