X-Git-Url: https://git.ucc.asn.au/?p=dja%2Fscandal.git;a=blobdiff_plain;f=scan2pages.sh;h=cbfe52f06bd4af008225c65a3426c9e3b0527f49;hp=069b4211dcbe997f259f69939ddd5162eda67f1f;hb=88f2331a5a94726bdf7c2b28f11c203a3f9ae15a;hpb=bdb5f5eb47668416dcd60d03f807b38e963a1501 diff --git a/scan2pages.sh b/scan2pages.sh index 069b421..cbfe52f 100755 --- a/scan2pages.sh +++ b/scan2pages.sh @@ -128,9 +128,18 @@ for scanpgnum in `$my_seq 1 $pages`; do done; # do ocr binarise -[ -e $outdir/scanpgs ] && rm -r $outdir/scanpgs -ocropus book2pages $outdir/scanpgs $outdir/scanpg-*.png || exit 1 +if [ -e $outdir/scanpgs ]; then + #assume (for the sake of speed in repeated runs) that + # if the last file exists, the process completed successfully + if [ -e $outdir/scanpgs/$(printf '%04d' $pages).bin.png ]; then + [[ $verbose ]] && echo Binarisation already complete + else + rm -r $outdir/scanpgs + fi +fi +[ -e $outdir/scanpgs ] || ocropus book2pages $outdir/scanpgs $outdir/scanpg-*.png || exit 1 +# process each binarised scan page for scanpgnum in `$my_seq 1 $pages`; do binscanpg=$outdir/scanpgs/$(printf '%04d' $scanpgnum).bin.png