Giter Site home page Giter Site logo

nvisa / dualfisheye2equirectangular Goto Github PK

View Code? Open in Web Editor NEW

This project forked from raboof/dualfisheye2equirectangular

0.0 2.0 0.0 14.12 MB

Convert 'dual-fisheye' 360 image material to equirectangular mapping

License: MIT License

Makefile 0.60% C 99.40%

dualfisheye2equirectangular's Introduction

Dual Fisheye to Equirectangular Projection Mapping

Many '360' camera's, such as the dokicam, consist of 2 fish-eye camera's.

Why DIY?

Those camera's typically come with desktop software or apps to manipulate the images and for example share to facebook.

It's fun to explore doing this without relying on the official software.

Storage

The dokicam stores its photos and videos on its memory card in JPG and MP4 format, easily accessible via USB storage without even removing the card.

Projection conversion

Those images and video's show the 'double fish-eye' nature of the device. Services like Facebook, however require, require 306 imagery to be mapped using the Equirectangular Projection. This can be achieved with ffmpeg using 2 'mapping files' for your image type.

Mapping generation

I did not find a suitable mapping for my camera online. However I did find projection.c by Floris Sluiter which could generate such mapping files for single-fisheye sources, and modified it to support double-fisheye.

Compile the generator code:

gcc -o projection projection.c -lm

Create mapping files for video and photo's:

./projection -x xmap_dokicam_video.pgm -y ymap_dokicam_video.pgm -h 1440 -w 2880 -r 1440 -c 2880 -b 35 -m samsung_gear_360
./projection -x xmap_dokicam.pgm -y ymap_dokicam.pgm -h 2048 -w 4096 -r 2048 -c 4096 -b 75 -m samsung_gear_360

Usage

Once you have created (or downloaded) the mapping files, use them with ffmpeg:

ffmpeg -i photo.jpg -i xmap_dokicam.pgm -i ymap_dokicam.pgm -filter_complex remap out.jpg
ffmpeg -i movie.mp4 -i xmap_dokicam_video.pgm -i ymap_dokicam_video.pgm -filter_complex remap out.mp4

For images, add exif metadata to help e.g. Facebook understand this is 360:

exiftool -ProjectionType="equirectangular" out.jpg

For videos, use Google's Spatial Metadata Injector with the following options: Image

Quality

The method used for mapping is a rather crude pixel-by-pixel conversion. You can clearly see the 'stitch' where the two images are joined together. You can probably achieve much better results with software that actually 'blends' together the images, like hugin, but that's also a bit more complicated ;).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.