From c74d2be3f41aa7d997122b10d5d55c25622dfd41 Mon Sep 17 00:00:00 2001 From: Jesper Zedlitz Date: Mon, 16 Oct 2017 12:52:20 +0200 Subject: [PATCH] also works with out pylab --- ocropus-gpageseg | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/ocropus-gpageseg b/ocropus-gpageseg index 9943a21a..88d069a8 100755 --- a/ocropus-gpageseg +++ b/ocropus-gpageseg @@ -13,8 +13,6 @@ from __future__ import print_function -from pylab import find - import argparse import glob import os @@ -108,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)