Skip to content

Commit

Permalink
Added Multimap, and data files. Finally got rid of vignetting, and a …
Browse files Browse the repository at this point in the history
…handy speed boost
  • Loading branch information
evertvorster committed Aug 28, 2017
1 parent 8c92e01 commit 51a70b4
Show file tree
Hide file tree
Showing 12 changed files with 97 additions and 710 deletions.
Binary file added Alpha_Map.tif
Binary file not shown.
62 changes: 62 additions & 0 deletions Multimap
@@ -0,0 +1,62 @@
#!/bin/bash
#This will split, defish, blend and re-assemble Samsung Gear 360 video

#trap Ctrl-C
set -e
trap 'printf "Received SIGINT: Terminating.\n"; rm -f $base"_Remap_360.mp4" ; exit 130' INT

Success_Remap(){
#Collect data
echo "Successful ffmpeg run."
#Copy attributes
chmod --reference="$1" "$2"
chown --reference="$1" "$2"
touch --reference="$1" "$2"
}


#dealing with filenames and extentions
fullpath="$1"
filename="${fullpath##*/}" # Strip longest match of */ from start
dir="${fullpath:0:${#fullpath} - ${#filename}}" # Substring from 0 thru pos of filename
base="${filename%.[^.]*}" # Strip shortest match of . plus at least one non-dot char from end
ext="${filename:${#base} + 1}" # Substring from len of base thru end
if [[ -z "$base" && -n "$ext" ]]; then # If we have an extension and no base, it's really the base
base=".$ext"
ext=""
fi

#set where the maps are kept
map_dir="/data/Projects/RemapFilter/"
#set where the remaps go
remap_dir="Remap"
mkdir -p "$remap_dir"
#Ffmpeg's wonderful remap filter
if ffmpeg -y -i "$1" \
-i "$map_dir"/l0000_x.tif -i "$map_dir"/l0000_y.tif \
-loop 1 -i "$map_dir"/Alpha_Map.tif \
-i "$map_dir"/r0000_x.tif -i "$map_dir"/r0000_y.tif \
-i "$map_dir"/l0000.tif -i "$map_dir"/r0000.tif \
-metadata:s:v spherical-video='<rdf:SphericalVideo xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:GSpherical="http://ns.google.com/videos/1.0/spherical/"> <GSpherical:Spherical>true</GSpherical:Spherical> <GSpherical:Stitched>true</GSpherical:Stitched> <GSpherical:ProjectionType>equirectangular</GSpherical:ProjectionType> </rdf:SphericalVideo>' \
-c:v hevc_nvenc -rc constqp -qp 21 -cq 21 \
-filter_complex \
"[3]alphaextract[alf]; \
[v:0]split=2[l][r]; \
[l][1][2]remap[l_remap]; \
[r][4][5]remap[r_remap]; \
[l_remap]setsar=sar=1/1[l_sar]; \
[r_remap]setsar=sar=1/1[r_sar]; \
[l_sar][6]blend=c0_mode=multiply[l_blend]; \
[r_sar][7]blend=c0_mode=multiply[r_blend]; \
[r_blend][alf]alphamerge[r_rm_a]; \
[l_blend][r_rm_a]overlay=0:0[merged]; \
[merged]eq=contrast=1.4:brightness=0.2:gamma=1.2:saturation=0.9[out]" \
-map [out] -map 0:a? "$remap_dir"/"$base""_Remap_360.mkv" < /dev/null ;
then
Success_Remap "$1" "$remap_dir"/"$base""_Remap_360.mkv"
else
rm -f "$remap_dir"/"$base""_Remap_360.mkv"
fi
#-hwaccel cuvid -c:v hevc_cuvid
#[r_blend][alf]alphamerge[r_rm_a]; \

733 changes: 31 additions & 702 deletions New_Dual_Remap_Calibrate.pto

Large diffs are not rendered by default.

6 changes: 2 additions & 4 deletions New_Dual_Remap_Left.pto
@@ -1,11 +1,11 @@
# hugin project file
#hugin_ptoversion 2
p f2 w3840 h1920 v360 E-0.0138789 R0 n"TIFF_m c:LZW r:CROP"
p f2 w3840 h1920 v360 E-0.0153582 R0 n"TIFF_m c:LZW r:CROP"
m g1 i0 f0 m2 p0.00784314

# image lines
#-hugin cropFactor=1
i w3840 h1920 f2 v380.841081703576 Ra0.907010734081268 Rb0.262976437807083 Rc0.638171255588531 Rd-0.350538939237595 Re0.162194848060608 Eev0 Er1 Eb1 r0.114115019790208 p-0.121035788005991 y179.984949301979 TrX0 TrY0 TrZ0 Tpy0 Tpp0 j0 a-0.295711332435112 b0.542884701384896 c-0.148325832969987 d-959.666574330775 e26.761428290552 g0 t0 Va1 Vb-1.62716302674335 Vc3.96985184912157 Vd-19.5922242796894 Vx-967.602840818105 Vy87.7999571466012 S0,1920,0,1920 Vm5 n"dual00002.jpg"
i w3840 h1920 f2 v380.153772705327 Ra-3.30760216712952 Rb2.92867398262024 Rc0.716169774532318 Rd-0.31006196141243 Re-0.453573703765869 Eev0 Er1 Eb1 r0 p0 y179.984949301979 TrX0 TrY0 TrZ0 Tpy0 Tpp0 j0 a-0.278019434079003 b0.516714354497362 c-0.136514446501568 d-959.815448504365 e25.5397730668826 g0 t0 Va1 Vb-0.964087746546393 Vc-4.78377125121393 Vd-1.81719104500266 Vx-960 Vy25 S0,1920,0,1920 Vm5 n"frames/dual00002.jpg"


# specify variables that should be optimized
Expand All @@ -23,8 +23,6 @@ v e0
v Vb0
v Vc0
v Vd0
v Vx0
v Vy0
v


Expand Down
6 changes: 2 additions & 4 deletions New_Dual_Remap_Right.pto
@@ -1,11 +1,11 @@
# hugin project file
#hugin_ptoversion 2
p f2 w3840 h1920 v360 E-0.0138789 R0 n"TIFF_m c:LZW r:CROP"
p f2 w3840 h1920 v360 E-0.0153582 R0 n"TIFF_m c:LZW r:CROP"
m g1 i0 f0 m2 p0.00784314

# image lines
#-hugin cropFactor=1
i w3840 h1920 f2 v382.778442473952 Ra-4.59360074996948 Rb-0.639229655265808 Rc0.400995522737503 Rd0.281042098999023 Re0.070686049759388 Eev-0.416368129298227 Er1 Eb1 r0.0591166964712425 p-2.14232299412238 y0.340818145907608 TrX0 TrY0 TrZ0 Tpy0 Tpp0 j0 a-0.31317052420513 b0.564938082931719 c-0.159239024765701 d961.163295015573 e20.2902038106583 g0 t0 Va1 Vb-4.21783263898007 Vc-5.75306692807982 Vd31.4486997469035 Vx967.597608176467 Vy5.90330984821146 S1921,3840,0,1920 Vm5 n"dual00002.jpg"
i w3840 h1920 f2 v382.358928863982 Ra-2.79765272140503 Rb2.72310757637024 Rc0.673592686653137 Rd-0.264506101608276 Re-0.454958379268646 Eev-0.0267905149151138 Er1 Eb1 r0.14152954028291 p-2.11562341622752 y0.347915860109861 TrX0 TrY0 TrZ0 Tpy0 Tpp0 j0 a-0.292520094912299 b0.53565973685822 c-0.148175899410145 d961.908821391949 e19.8543571254121 g0 t0 Va1 Vb-0.393178208999661 Vc-8.35111713839654 Vd-2.21655014128716 Vx960 Vy0 S1921,3840,0,1920 Vm5 n"frames/dual00002.jpg"


# specify variables that should be optimized
Expand All @@ -27,8 +27,6 @@ v e0
v Vb0
v Vc0
v Vd0
v Vx0
v Vy0
v


Expand Down
Binary file added grey.tif
Binary file not shown.
Binary file modified l0000.tif
Binary file not shown.
Binary file modified l0000_x.tif
Binary file not shown.
Binary file modified l0000_y.tif
Binary file not shown.
Binary file modified r0000.tif
Binary file not shown.
Binary file modified r0000_x.tif
Binary file not shown.
Binary file modified r0000_y.tif
Binary file not shown.

0 comments on commit 51a70b4

Please sign in to comment.