-
Notifications
You must be signed in to change notification settings - Fork 1
/
run
executable file
·84 lines (81 loc) · 2.26 KB
/
run
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#!/bin/bash
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[0;33m'
BLUE='\033[0;34m'
NC='\033[0m' # No Color
ERROR="[${RED}ERROR${NC}]"
INFO="[${BLUE}INFO${NC}]"
WARNING="[${YELLOW}WARNING${NC}]"
OK="[${GREEN}OK${NC}]"
CURRENT_DIR=$(pwd)
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
echo
cat LICENSE
echo
echo
echo
echo -e "${INFO} Checking prerequisites..."
if ffmpeg -version >/dev/null; then
echo -e "${OK} FFmpeg is installed."
else
echo -e "${ERROR} FFmpeg is not installed."
exit 2
fi
if python --version | egrep "Python 3." >/dev/null; then
echo -e "${OK} Python 3.X is installed."
else
echo -e "${ERROR} Python 3.X is not installed."
echo -e "${INFO} Maybe you should install 'python-is-python3'".
exit 2
fi
if vicalib --version > /dev/null; then
echo -e "${OK} Vicalib is installed."
else
echo -e "${ERROR} Vicalib is not installed."
exit 2
fi
echo
echo
echo "Download the EndoMapper dataset at:"
echo "https://doi.org/10.7303/syn26707219"
echo
echo "To calibrate your own sequence, add a new 'Endoscope_XX' folder following the original dataset structure."
echo
echo "The calibration sequences should be accesible at 'DATASET/Calibrations/Endoscope_XX'."
echo
echo -n "Provide the path where you downloaded the DATASET: "
read DATASET_DIR
echo
echo -e "${INFO} Using '${DATASET_DIR}'..."
echo
echo
echo "Select camera model:"
echo " - kb4: The Kannala Brandt fisheye camera model (default)."
echo " - poly2: Polynomial pinhole camera model with two distortion parameters."
echo
echo -n "For EndoMapper dataset use kb4 (default): "
read CAMERA_MODEL
if [ "$CAMERA_MODEL" != "poly2" ]; then
CAMERA_MODEL="kb4"
fi
echo
echo
echo -e "${INFO} Using '${CAMERA_MODEL}' camera model..."
echo
echo
echo -e "Have you checked the image mask at 'utils/mask.png'? [Y/n]: "
read YES_NO
if [ "$YES_NO" == "n" ] ||[ "$YES_NO" == "N" ]; then
echo -e "${WARNING} Please make sure that the current image mask matches the camera(s) you will be calibrating."
exit 2
fi
echo
echo
chmod +x ${SCRIPT_DIR}/utils/prepare_dataset.sh
${SCRIPT_DIR}/utils/prepare_dataset.sh ${DATASET_DIR} ${CAMERA_MODEL}
echo
echo
chmod +x ${SCRIPT_DIR}/utils/calibrate_dataset.sh
${SCRIPT_DIR}/utils/calibrate_dataset.sh ${DATASET_DIR}
cd ${CURRENT_DIR}