You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

readme.md 3.7 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. # Generating multi-resolution tiles for a panorama
  2. ## Get a Panorama
  3. If you don't have your own, it's easy to use one of the examples in the repository.
  4. From this directory, run:
  5. ```bash
  6. $ cp ../../examples/examplepano.jpg .
  7. ```
  8. ## Generate tiles
  9. To use the `generate.py` script, either its dependencies need to be installed,
  10. or [Docker](https://www.docker.com/) can be used to avoid this installation.
  11. ### Option 1: with local dependencies
  12. The `generate.py` script depends on `nona` (from [Hugin](http://hugin.sourceforge.net/)),
  13. as well as Python with the [Pillow](https://pillow.readthedocs.org/) package. On Ubuntu,
  14. these dependencies can be installed by running:
  15. ```bash
  16. $ sudo apt install python3 python3-pil hugin-tools
  17. ```
  18. Once the dependencies are installed, a tileset can generated with:
  19. ```bash
  20. $ python3 generate.py examplepano.jpg
  21. Processing input image information...
  22. Assuming --haov 360.0
  23. Assuming --vaov 180.0
  24. Generating cube faces...
  25. Generating tiles...
  26. Generating fallback tiles...
  27. ```
  28. ### Option 2: with Docker
  29. A small Dockerfile is provided that allows one to easily generate a panorama tileset
  30. with the [generate.py](generate.py) script, without needing to install dependencies
  31. on one's host.
  32. First, build the Docker container:
  33. ```bash
  34. $ docker build -t generate-panorama .
  35. ```
  36. When it's finished, you can bind the present working directory to a location in
  37. the container (`/data`) so that your image is found in the container. Notice
  38. that the output needs to be specified in a directory that is bound to the host:
  39. ```bash
  40. $ docker run -it -v $PWD:/data generate-panorama --output /data/output /data/examplepano.jpg
  41. Processing input image information...
  42. Assuming --haov 360.0
  43. Assuming --vaov 180.0
  44. Generating cube faces...
  45. Generating tiles...
  46. Generating fallback tiles...
  47. ```
  48. ## Viewing output (for either method)
  49. The final output will be in your present working directory:
  50. ```bash
  51. $ ls output/
  52. 1 2 3 config.json fallback
  53. ```
  54. Next, change back to the root and start a server:
  55. ```bash
  56. $ cd ../..
  57. $ python3 -m http.server
  58. ```
  59. A generated tileset and configuration in `utils/multires/output` can then be viewed by navigating a browser to:
  60. [http://localhost:8000/src/standalone/pannellum.htm?config=../../utils/multires/output/config.json](http://localhost:8000/src/standalone/pannellum.htm?config=../../utils/multires/output/config.json)
  61. When the page is loaded, the console will output a logging stream corresponding to the HTTP requests:
  62. ```bash
  63. 127.0.0.1 - - [09/Aug/2019 09:41:24] "GET /src/standalone/pannellum.htm?config=../../utils/multires/output/config.json HTTP/1.1" 200 -
  64. 127.0.0.1 - - [09/Aug/2019 09:41:24] "GET /src/css/pannellum.css HTTP/1.1" 200 -
  65. 127.0.0.1 - - [09/Aug/2019 09:41:24] "GET /src/standalone/standalone.css HTTP/1.1" 200 -
  66. 127.0.0.1 - - [09/Aug/2019 09:41:24] "GET /src/js/libpannellum.js HTTP/1.1" 200 -
  67. 127.0.0.1 - - [09/Aug/2019 09:41:24] "GET /src/js/pannellum.js HTTP/1.1" 200 -
  68. 127.0.0.1 - - [09/Aug/2019 09:41:24] "GET /src/standalone/standalone.js HTTP/1.1" 200 -
  69. 127.0.0.1 - - [09/Aug/2019 09:41:24] "GET /utils/multires/output/config.json HTTP/1.1" 200 -
  70. 127.0.0.1 - - [09/Aug/2019 09:41:24] "GET /src/css/img/background.svg HTTP/1.1" 200 -
  71. 127.0.0.1 - - [09/Aug/2019 09:41:24] "GET /src/css/img/sprites.svg HTTP/1.1" 200 -
  72. 127.0.0.1 - - [09/Aug/2019 09:41:24] "GET /src/css/img/compass.svg HTTP/1.1" 200 -
  73. 127.0.0.1 - - [09/Aug/2019 09:41:26] "GET /src/css/img/grab.svg HTTP/1.1" 200 -
  74. 127.0.0.1 - - [09/Aug/2019 09:41:27] "GET /utils/multires/output//1/r0_0.jpg HTTP/1.1" 200 -
  75. 127.0.0.1 - - [09/Aug/2019 09:41:27] "GET /utils/multires/output//1/f0_0.jpg HTTP/1.1" 200 -
  76. 127.0.0.1 - - [09/Aug/2019 09:41:27] "GET /utils/multires/output//1/u0_0.jpg HTTP/1.1" 200 -
  77. ...
  78. ```
  79. The panorama, in multi-resolution format, should display in the browser.