Skip to content

Instantly share code, notes, and snippets.

@wincentbalin
Created January 31, 2014 08:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wincentbalin/8728168 to your computer and use it in GitHub Desktop.
Save wincentbalin/8728168 to your computer and use it in GitHub Desktop.
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