- Correction for insta360
Last active
April 15, 2023 09:10
-
-
Save typebrook/c161704460aed34351e68b5a46df1b4b to your computer and use it in GitHub Desktop.
Panorama solution2 for insta360 images (deprecated)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
*.insp | |
*.jpg |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.ONESHELL: | |
FOV ?= 205 | |
OUTPUT ?= e | |
WIDTH ?= 2900 | |
B1 ?= 1519 | |
B2 ?= 4559 | |
W ?= 70 | |
batch: | |
ffmpeg -y -hide_banner \ | |
-f image2 \ | |
-pattern_type glob \ | |
-i input/'*.insp' \ | |
-vf "v360=input=dfisheye:$(OUTPUT):ih_fov=$(FOV):iv_fov=$(FOV):yaw=0:pitch=0:roll=90,geq=cb_expr='cb(X,Y)':cr_expr='cr(X,Y)':lum_expr='clip(lum(X,Y)+between(X,$(B1)-$(W),$(B1))*lerp(0,lum($(B1)+1,Y)-lum($(B1),Y),(X-$(B1)+$(W))/$(W))+between(X,$(B2)-$(W),$(B2))*lerp(0,lum($(B2)+1,Y)-lum($(B2),Y),(X-$(B2)+$(W))/$(W)),0,255)'" \ | |
-threads 8 \ | |
output/'%03d.jpg' | |
test: | |
ffmpeg -y -i cropped.jpg -vf v360=dfisheye:equirect:ih_fov=$(FOV):iv_fov=$(FOV):yaw=0 output.jpg | |
exiftool -UsePanoramaViewer=TRUE -ProjectionType="equirectangular" output.jpg | |
which SimplePanoramaViewer 2>/dev/null && SimplePanoramaViewer output.jpg | |
crop: | |
crop=$$(( (3040 - $(WIDTH)) / 2 )) | |
convert test.jpg -crop $(WIDTH)x$(WIDTH)+$${crop}+$${crop} -rotate 90 part1.jpg | |
convert test.jpg -crop $(WIDTH)x$(WIDTH)+$$(( 3040 + $$crop ))+$${crop} -rotate 270 part2.jpg | |
convert +append part{1,2}.jpg cropped.jpg | |
half: | |
ffmpeg -y -i part1.jpg -vf v360=fisheye:equirect:ih_fov=$(FOV):iv_fov=$(FOV):yaw=0 output1.jpg | |
ffmpeg -y -i part2.jpg -vf v360=fisheye:equirect:ih_fov=$(FOV):iv_fov=$(FOV):yaw=0 output2.jpg |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment