File size: 2,078 Bytes
08b23ce
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
#!/bin/bash

echo "Running animation..."

# copy rig and mesh for animation
for txt_file in results/final_rigging/*.txt; do
    if [ -f "$txt_file" ]; then
        seq_name=$(basename "$txt_file" .txt)
        
        mkdir -p "examples/$seq_name/objs/"
        
        cp "$txt_file" "examples/$seq_name/objs/rig.txt"
        echo "Copied $txt_file -> examples/$seq_name/objs/rig.txt"
        
        obj_file="examples/$seq_name.obj"
        if [ -f "$obj_file" ]; then
            cp "$obj_file" "examples/$seq_name/objs/mesh.obj"
            echo "Copied $obj_file -> examples/$seq_name/objs/mesh.obj"
        else
            echo "Warning: $obj_file not found"
        fi
        
        # extract frames
        video_file="examples/$seq_name/input.mp4"
        if [ -f "$video_file" ]; then
            echo "Found video file: $video_file"
            cd "examples/$seq_name"
            mkdir -p imgs
            ffmpeg -i input.mp4 -vf fps=10 imgs/frame_%04d.png -y
            echo "Extracted frames from $video_file to imgs/"
            cd ../../
        else
            echo "No video file found: $video_file"
        fi
    fi
done

cd animation

# save flow
echo "Processing sequences with save_flow.py..."
for seq_dir in ../examples/*/; do
    if [ -d "$seq_dir" ]; then
        seq_name=$(basename "$seq_dir")
        echo "Processing sequence: $seq_name"
        python utils/save_flow.py --input_path ../examples --seq_name "$seq_name"
    fi
done

# animation
echo "Running optimization for each sequence..."
mkdir -p ../results/animation

python optimization.py --save_path ../results/animation --iter 200 --input_path ../examples --img_size 960 \
        --seq_name 'spiderman' --save_name 'spiderman_demo'

python optimization.py --save_path ../results/animation --iter 200 --input_path ../examples --img_size 960 \
        --seq_name 'deer' --save_name 'deer_demo' --smooth_weight 1 --main_renderer front_left --additional_renderer "right,front_right,back_right"

echo "Animation completed."

cd ..
echo "Puppeteer pipeline completed successfully!"