Use ocrd_olena for binarization

pull/27/head
Gerber, Mike 5 years ago
parent 63c364207c
commit 7025d960b4

@ -15,11 +15,13 @@ RUN apt-get update && \
python3-pip \ python3-pip \
git \ git \
# For leptonica/tesseract: # For leptonica/tesseract:
cmake libgif-dev libjpeg-dev libpng-dev libtiff-dev zlib1g-dev \ cmake libgif-dev libjpeg-dev libpng-dev libtiff-dev zlib1g-dev libpango1.0-dev \
# For clstm on Ubuntu 19.04: # For clstm on Ubuntu 19.04:
swig libeigen3-dev libpng-dev libprotobuf-dev \ swig libeigen3-dev libpng-dev libprotobuf-dev \
# For cv2: # For cv2:
libsm6 libxrender1 \ libsm6 libxrender1 \
# For ocrd_olena:
wget graphviz imagemagick libmagick++-dev libgraphicsmagick++1-dev libboost-dev \
# XML utils # XML utils
libxml2-utils \ libxml2-utils \
xmlstarlet \ xmlstarlet \
@ -47,6 +49,15 @@ RUN curl -sSL -O https://github.com/tesseract-ocr/tessdata_best/archive/$TESSDAT
rm -rf $TESSDATA_BEST_VERSION.tar.gz rm -rf $TESSDATA_BEST_VERSION.tar.gz
# Build ocrd_olena
RUN curl -sSL -o ocrd_olena.tar.gz https://github.com/OCR-D/ocrd_olena/archive/fde4436.tar.gz && \
mkdir ocrd_olena && \
tar xvz -C ocrd_olena --strip-components=1 -f ocrd_olena.tar.gz && \
cd ocrd_olena && \
make install PREFIX=/usr/local && \
cd .. && rm -rf ocrd_olena ocrd_olena.tar.gz
# Copy OCR models # Copy OCR models
RUN mkdir -p /var/lib/calamari-models RUN mkdir -p /var/lib/calamari-models
COPY data/calamari-models/GT4HistOCR /var/lib/calamari-models/GT4HistOCR COPY data/calamari-models/GT4HistOCR /var/lib/calamari-models/GT4HistOCR

@ -36,8 +36,9 @@ do_binarization() {
# Binarize the images # Binarize the images
remove_filegrp OCR-D-IMG-BIN mets.xml remove_filegrp OCR-D-IMG-BIN mets.xml
ocrd-kraken-binarize -l $LOG_LEVEL \ ocrd-olena-binarize -l $LOG_LEVEL \
-m mets.xml -I OCR-D-IMG -O OCR-D-IMG-BIN -m mets.xml -I OCR-D-IMG -O OCR-D-IMG-BIN \
-p <(echo '{"impl": "sauvola-ms-split"}')
} }
do_fontident() { do_fontident() {
@ -143,7 +144,7 @@ page_fix_image_references_to_bin() {
for file in `ocrd workspace find -G $filegrp`; do for file in `ocrd workspace find -G $filegrp`; do
# Arrays with filenames to the images # Arrays with filenames to the images
imgs=(`ocrd workspace find -G OCR-D-IMG`) imgs=(`ocrd workspace find -G OCR-D-IMG`)
imgs_bin=(`ocrd workspace find -G OCR-D-IMG-BIN`) imgs_bin=(`ocrd workspace find -G OCR-D-IMG-BIN -m image/png`)
# Change all image references to point to the corresponding binarized image # Change all image references to point to the corresponding binarized image
for i in ${!imgs[@]}; do for i in ${!imgs[@]}; do

Loading…
Cancel
Save