Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Makefile for batch OCR
CONVERT = convert
IMFLAGS = -verbose -colorspace gray -median 3x3 -resize 300% -blur 10
TESSERACT = tesseract
RM = rm
SRCS = $(wildcard *.pbm)
INTERMEDIATES = ${SRCS:.pbm=.tiff}
RESULTS = ${SRCS:.pbm=.txt}
.PHONY: all
all: $(RESULTS)
.PRECIOUS: $(INTERMEDIATES)
clean:
$(RM) -f $(INTERMEDIATES) $(RESULTS)
%.tiff: %.pbm
$(CONVERT) $(IMFLAGS) $< $@
%.txt: %.tiff
$(TESSERACT) $< $(basename $@) -l deu
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment