-
wrapper around 360-converter c++ library
-
Input images must be square sized
-
Wide image format support for input image
-
Output Image format, .png
-
--help
--> shows Help Message -
--input-{face} {path}
--> with face being (front,right,back,left,top,down), Path of each of the 6 needed faces -
--output {path}
-> Output Image Path with extension(Only .png supported at the time) -
--type {type}
--> with type being (cubemap,equirectangular,stereographic), Method of conversion -
Example:
./360-converte-cli.exe --input-front square.jpg --input-right square2.jpg --input-back square3.jpg --input-left square4.jpg --input-top square5.jpg --input-down square6.jpg --type cubemap --output output.png
Input one of the following type 360 image and convert it to another one.
Faces | Cubemap | Equirectangular | Stereographic |
---|---|---|---|
This project has been tested on:
- Ubuntu 18.04
- G++ 7.5.0
- Clang 6.0.0
The only thing you need is a C/C++ compiler, no other package do you need to install.
git clone https://github.com/chinhsuanwu/360-converter.git
cd 360-converter
make
make run
Just directly include the converter.hpp
in folder src
.
#include "src/converter.hpp"
For example, the conversion from Face
to Cube
, Equi
and Stereo
can be shown as below, other conversions can be deduced:
-
To convert from
Face
toEqui
Converter::Equi equi = face.toEqui();
-
To get image
Converter::Image img = equi.getEqui();
-
For
Stereo
images, you can assignTOP
orDOWN
, while the default will beDOWN
Converter::Image img = cube.toStereo(Converter::TOP).getStereo();
TOP
DOWN
-
To load image
img.img = stbi_load("assets/equi.png", &w, &h, &bpp, CHANNEL_NUM); img.w = w, img.h = h;
-
To write image
stbi_write_png("out/equi.png", img.w, img.h, CHANNEL_NUM, img.img, img.w*CHANNEL_NUM);
Find out more at example.cpp.
This project is using stb library for image I/O in example.cpp, great thanks to their excellent work.