You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

57 lines
1.7 KiB
Makefile

images=$(wildcard images/*.jpg)
# creates: images/001.jpg images/002.jpg images/000.jpg
tmpfile:= $(shell mktemp)
color_w:="\033[0;29m" # add color to output
color_r:="\033[0;31m" # echo $(color_r) something
color_g:="\033[0;32m"
color_b:="\033[0;34m"
space:= $(empty) $(empty)
newline:= '\n'
listtxt:= $(subst $(space),$(newline),$(images))
OS:= $(shell uname)
# subst is a way to do string replacements, it works like this: $(subst $(delimitator),$(replacement),$(list))
# it's used here to make a list of the images, with one filename on each line
rmtmp:
rm $(tmpfile)
testif:
ifeq ($(OS),Darwin)
@echo $(OS)
endif
dirs: # create the directories for the working structures
mkdir images # scanned image dir
mkdir output # outputs dir
@echo $(color_r)'Directories made'
tesseract:
echo $(listtxt) > output/list.txt
tesseract output/list.txt output/plain
myscript: tesseract
cat output/plain.txt | python3 src/myscript.py > output/a-new-file.txt
wordtagger: tesseract
cat output/plain.txt | python3 src/wordtagger.py > output/tagged-words.txt
visualization: $(images) $(tmpfile) #requires mplayer
@echo $(tmpfile)
for i in $(images); do \
cat $$i >> $(tmpfile); \
done;
ifeq ($(OS),Darwin)
cat $(tmpfile) | mplayer -sws 4 -zoom -vf dsize=720:720 -demuxer rawvideo -rawvideo w=56:h=64:i420:fps=25 -;
else
cat $(tmpfile) | mplayer -vo x11 -sws 4 -zoom -vf dsize=720:720 -demuxer rawvideo -rawvideo w=50:h=50:i420:fps=25 -;
endif
# ifeq ($(shell uname), Linux)
# cat $(tmpfile) | mplayer -vo x11 -sws 4 -zoom -vf dsize=720:720 -demuxer rawvideo -rawvideo w=50:h=50:i420:fps=25 -;\
# ** Makefile Syntax notes **
# @ preceding command tells make not to print the command being executed
#