-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpin_align_prep.sh
executable file
·32 lines (31 loc) · 1.55 KB
/
pin_align_prep.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/bin/bash
#
# pin_align_prep.sh -- prepare a pin alignment image for
# comparison between 0 and 90 degree images
# H. J. Bernstein, 3 Jan 2019
# rev 16 Jan 2019
#
if [ "${1}xx" == "--help" ]; then
echo "pin_align_prep.sh image_in image_out [base_image_out [sub_base_image_out]]"
echo " prepare a pin alignment image, image_in, for"
echo " comparison between 0 and 90 degree images"
echo " writing the resulting image to image_out"
echo " and optionally the 50 pixel strip in base_image_out"
echo " and optionally the 80 pixel strip in sub_base_image_out"
echo " assuming a 1280x1024 image and imgagemagick convert"
echo " in the PATH"
echo " $2 pin tip, $3 is base, $4 is sub_base"
exit
fi
. $PIN_ALIGN_ROOT/pin_align_config.sh
tmp_dir=$PWD/${USER}_pin_align_$$
mkdir $tmp_dir
convert $1 -contrast -contrast ${tmp_dir}/$1
# Windows width x height (px) + horizontal offset + vertical offset from top left corner
convert ${tmp_dir}/$1 -crop $PIN_ALIGN_PIN_TIP_WINDOW -canny 2x1 -negate -colorspace Gray -morphology Erode Octagon:1 -morphology Dilate Octagon:1 $2
if [ "${3}xx" != "xx" ]; then
convert ${tmp_dir}/$1 -crop $PIN_ALIGN_BASE_WINDOW -canny 2x1 -negate -colorspace Gray -morphology Erode Octagon:1 -morphology Dilate Octagon:1 $3
if [ "${4}xx" != "xx" ]; then
convert ${tmp_dir}/$1 -crop $PIN_ALIGN_SUB_BASE_WINDOW -canny 2x1 -negate -colorspace Gray -morphology Erode Octagon:1 -morphology Dilate Octagon:1 $4
fi
fi