-
Notifications
You must be signed in to change notification settings - Fork 1
/
prepare_data.sh
66 lines (51 loc) · 1.96 KB
/
prepare_data.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
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
set -ex
# . prepare_data.sh &
export DISPLAY=:0
# working directory
cd preprocessing
################
## input data ##
################
# sequence name
SEQ=room1
# filename of the input mesh that also has uv coordinates (*.off is supported)
MESH_FILENAME=../datasets/$SEQ/room_uv.off
# directory of the camera information (filenames are assumed to be 0.txt, 1.txt, ....)
# (each file contains per frame extrinsics and intrinsics, both stored as 4x4 matrices)
CAMERA_DIR=../datasets/$SEQ/frames/ZMojNkEp431/camera/
# directory of the original images (filenames are assumed to be 0.jpg, 1.jpg, ....)
IMG_DIR=../datasets/$SEQ/frames/ZMojNkEp431/color/
# file list containing the frame ids (per line one id)
FILE_LIST=../datasets/$SEQ/ZMojNkEp431_room0__0__.txt
# image resolution of the original images
WIDTH_ORIG=320
HEIGHT_ORIG=256
#################
## output data ##
#################
# note that the output dimensions can be a multiple of the input dimensions (e.g. to increase sample rate)
#WIDTH_RENDERING=1280
#HEIGHT_RENDERING=1024
WIDTH_RENDERING=320
HEIGHT_RENDERING=256
# output folders
OUTPUT_DIR_UV=../datasets/$SEQ/uvs/
OUTPUT_DIR_POS=../datasets/$SEQ/pos/
OUTPUT_DIR_IMG=../datasets/$SEQ/images/
mkdir -p $OUTPUT_DIR_UV
mkdir -p $OUTPUT_DIR_POS
mkdir -p $OUTPUT_DIR_IMG
###############
## copy data ##
###############
# copy original images and camera files to dataset folder
while read -r file_name; do cp $IMG_DIR${file_name%?}.jpg $OUTPUT_DIR_IMG ; done < $FILE_LIST
while read -r file_name; do cp $CAMERA_DIR${file_name%?}.txt $OUTPUT_DIR_IMG ; done < $FILE_LIST
#cp $IMG_DIR/* $OUTPUT_DIR_IMG/
########################
## render the uv maps ##
########################
CAMERA_DIR_NEW=$OUTPUT_DIR_IMG
#./uv_renderer $MESH_FILENAME $CAMERA_DIR_NEW $OUTPUT_DIR_UV $WIDTH_ORIG $HEIGHT_ORIG $WIDTH_RENDERING $HEIGHT_RENDERING
./uv_pos_renderer_bin $MESH_FILENAME $CAMERA_DIR_NEW $OUTPUT_DIR_UV $OUTPUT_DIR_POS $WIDTH_ORIG $HEIGHT_ORIG $WIDTH_RENDERING $HEIGHT_RENDERING
cd ..