Matthew Petroff 33bc23dba9 | 2 年前 | |
---|---|---|
.. | ||
Dockerfile | 3 年前 | |
generate.py | 2 年前 | |
readme.md | 3 年前 |
If you don’t have your own, it’s easy to use one of the examples in the repository. From this directory, run:
$ cp ../../examples/examplepano.jpg .
To use the generate.py
script, either its dependencies need to be installed,
or Docker can be used to avoid this installation.
The generate.py
script depends on nona
(from Hugin),
as well as Python 3 with the Pillow and
NumPy packages. The pyshtools
Python package is also recommended. On Ubuntu, these dependencies can be
installed by running:
$ sudo apt install python3 python3-pil python3-numpy python3-pip hugin-tools
$ pip3 install --user pyshtools
If you have issues installing pyshtools
, you may be on an architecture for
which PyPI does not have pre-built binaries. In this case, you might need to
install the dependencies described in the
pyshtools build-from-source directions.
Once the dependencies are installed, a tileset can generated with:
$ python3 generate.py examplepano.jpg
Processing input image information...
Assuming --haov 360.0
Assuming --vaov 180.0
Generating cube faces...
Generating tiles...
Generating fallback tiles...
A small Dockerfile is provided that allows one to easily generate a panorama tileset with the generate.py script, without needing to install dependencies on one’s host.
First, build the Docker container:
$ docker build -t generate-panorama .
When it’s finished, you can bind the present working directory to a location in
the container (/data
) so that your image is found in the container. Notice
that the output needs to be specified in a directory that is bound to the host:
$ docker run -it -v $PWD:/data generate-panorama --output /data/output /data/examplepano.jpg
Processing input image information...
Assuming --haov 360.0
Assuming --vaov 180.0
Generating cube faces...
Generating tiles...
Generating fallback tiles...
The final output will be in your present working directory:
$ ls output/
1 2 3 config.json fallback
Next, change back to the root and start a server:
$ cd ../..
$ python3 -m http.server
A generated tileset and configuration in utils/multires/output
can then be viewed by navigating a browser to:
http://localhost:8000/src/standalone/pannellum.htm#config=../../utils/multires/output/config.json
When the page is loaded, the console will output a logging stream corresponding to the HTTP requests:
127.0.0.1 - - [09/Aug/2019 09:41:24] "GET /src/standalone/pannellum.htm HTTP/1.1" 200 -
127.0.0.1 - - [09/Aug/2019 09:41:24] "GET /src/css/pannellum.css HTTP/1.1" 200 -
127.0.0.1 - - [09/Aug/2019 09:41:24] "GET /src/standalone/standalone.css HTTP/1.1" 200 -
127.0.0.1 - - [09/Aug/2019 09:41:24] "GET /src/js/libpannellum.js HTTP/1.1" 200 -
127.0.0.1 - - [09/Aug/2019 09:41:24] "GET /src/js/pannellum.js HTTP/1.1" 200 -
127.0.0.1 - - [09/Aug/2019 09:41:24] "GET /src/standalone/standalone.js HTTP/1.1" 200 -
127.0.0.1 - - [09/Aug/2019 09:41:24] "GET /utils/multires/output/config.json HTTP/1.1" 200 -
127.0.0.1 - - [09/Aug/2019 09:41:24] "GET /src/css/img/background.svg HTTP/1.1" 200 -
127.0.0.1 - - [09/Aug/2019 09:41:24] "GET /src/css/img/sprites.svg HTTP/1.1" 200 -
127.0.0.1 - - [09/Aug/2019 09:41:24] "GET /src/css/img/compass.svg HTTP/1.1" 200 -
127.0.0.1 - - [09/Aug/2019 09:41:26] "GET /src/css/img/grab.svg HTTP/1.1" 200 -
127.0.0.1 - - [09/Aug/2019 09:41:27] "GET /utils/multires/output//1/r0_0.jpg HTTP/1.1" 200 -
127.0.0.1 - - [09/Aug/2019 09:41:27] "GET /utils/multires/output//1/f0_0.jpg HTTP/1.1" 200 -
127.0.0.1 - - [09/Aug/2019 09:41:27] "GET /utils/multires/output//1/u0_0.jpg HTTP/1.1" 200 -
...
The panorama, in multi-resolution format, should display in the browser.