Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  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 3 with the [Pillow](https://pillow.readthedocs.org/) and
  14. [NumPy](https://numpy.org/) packages. The [pyshtools](https://shtools.github.io/SHTOOLS/)
  15. Python package is also recommended. On Ubuntu, these dependencies can be
  16. installed by running:
  17. ```bash
  18. $ sudo apt install python3 python3-pil python3-numpy python3-pip hugin-tools
  19. $ pip3 install --user pyshtools
  20. ```
  21. If you have issues installing `pyshtools`, you may be on an architecture for
  22. which PyPI does not have pre-built binaries. In this case, you might need to
  23. install the dependencies described in the
  24. [pyshtools build-from-source directions](https://shtools.github.io/SHTOOLS/python-installing.html#build-from-source).
  25. Once the dependencies are installed, a tileset can generated with:
  26. ```bash
  27. $ python3 generate.py examplepano.jpg
  28. Processing input image information...
  29. Assuming --haov 360.0
  30. Assuming --vaov 180.0
  31. Generating cube faces...
  32. Generating tiles...
  33. Generating fallback tiles...
  34. ```
  35. ### Option 2: with Docker
  36. A small Dockerfile is provided that allows one to easily generate a panorama tileset
  37. with the [generate.py](generate.py) script, without needing to install dependencies
  38. on one's host.
  39. First, build the Docker container:
  40. ```bash
  41. $ docker build -t generate-panorama .
  42. ```
  43. When it's finished, you can bind the present working directory to a location in
  44. the container (`/data`) so that your image is found in the container. Notice
  45. that the output needs to be specified in a directory that is bound to the host:
  46. ```bash
  47. $ docker run -it -v $PWD:/data generate-panorama --output /data/output /data/examplepano.jpg
  48. Processing input image information...
  49. Assuming --haov 360.0
  50. Assuming --vaov 180.0
  51. Generating cube faces...
  52. Generating tiles...
  53. Generating fallback tiles...
  54. ```
  55. ## Viewing output (for either method)
  56. The final output will be in your present working directory:
  57. ```bash
  58. $ ls output/
  59. 1 2 3 config.json fallback
  60. ```
  61. Next, change back to the root and start a server:
  62. ```bash
  63. $ cd ../..
  64. $ python3 -m http.server
  65. ```
  66. A generated tileset and configuration in `utils/multires/output` can then be viewed by navigating a browser to:
  67. [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)
  68. When the page is loaded, the console will output a logging stream corresponding to the HTTP requests:
  69. ```bash
  70. 127.0.0.1 - - [09/Aug/2019 09:41:24] "GET /src/standalone/pannellum.htm HTTP/1.1" 200 -
  71. 127.0.0.1 - - [09/Aug/2019 09:41:24] "GET /src/css/pannellum.css HTTP/1.1" 200 -
  72. 127.0.0.1 - - [09/Aug/2019 09:41:24] "GET /src/standalone/standalone.css HTTP/1.1" 200 -
  73. 127.0.0.1 - - [09/Aug/2019 09:41:24] "GET /src/js/libpannellum.js HTTP/1.1" 200 -
  74. 127.0.0.1 - - [09/Aug/2019 09:41:24] "GET /src/js/pannellum.js HTTP/1.1" 200 -
  75. 127.0.0.1 - - [09/Aug/2019 09:41:24] "GET /src/standalone/standalone.js HTTP/1.1" 200 -
  76. 127.0.0.1 - - [09/Aug/2019 09:41:24] "GET /utils/multires/output/config.json HTTP/1.1" 200 -
  77. 127.0.0.1 - - [09/Aug/2019 09:41:24] "GET /src/css/img/background.svg HTTP/1.1" 200 -
  78. 127.0.0.1 - - [09/Aug/2019 09:41:24] "GET /src/css/img/sprites.svg HTTP/1.1" 200 -
  79. 127.0.0.1 - - [09/Aug/2019 09:41:24] "GET /src/css/img/compass.svg HTTP/1.1" 200 -
  80. 127.0.0.1 - - [09/Aug/2019 09:41:26] "GET /src/css/img/grab.svg HTTP/1.1" 200 -
  81. 127.0.0.1 - - [09/Aug/2019 09:41:27] "GET /utils/multires/output//1/r0_0.jpg HTTP/1.1" 200 -
  82. 127.0.0.1 - - [09/Aug/2019 09:41:27] "GET /utils/multires/output//1/f0_0.jpg HTTP/1.1" 200 -
  83. 127.0.0.1 - - [09/Aug/2019 09:41:27] "GET /utils/multires/output//1/u0_0.jpg HTTP/1.1" 200 -
  84. ...
  85. ```
  86. The panorama, in multi-resolution format, should display in the browser.