GithubHelp home page GithubHelp logo

indus / kubi Goto Github PK

View Code? Open in Web Editor NEW
49.0 4.0 15.0 790 KB

a fast and flexible cubemap generator

License: MIT License

Python 97.42% Batchfile 2.58%
python libvips panorama cubemap 360-photo equirectangular-to-cubemap

kubi's People

Contributors

crawld avatar indus avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

kubi's Issues

IIIF layout not working

Testet on MacOS, Python installed by Homebrew:

 /opt/homebrew/bin/kubi -co layout=iiif  static/images/FW-Handeln-000.jpg test
Traceback (most recent call last):
  File "/opt/homebrew/bin/kubi", line 8, in <module>
    sys.exit(run())
             ^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/kubi/kubi.py", line 347, in run
    main(sys.argv[1:])
  File "/opt/homebrew/lib/python3.11/site-packages/kubi/kubi.py", line 343, in main
    kubi(args)
  File "/opt/homebrew/lib/python3.11/site-packages/kubi/kubi.py", line 227, in kubi
    mapim.write_to_file(f'{dst}_{fn}{dst_ext}', **args.co)
  File "/opt/homebrew/lib/python3.11/site-packages/pyvips/vimage.py", line 804, in write_to_file
    return pyvips.Operation.call(name, self, filename,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/pyvips/voperation.py", line 288, in call
    raise Error('{0} does not support optional argument {1}'
pyvips.error.Error: VipsForeignSaveJpegFile does not support optional argument layout

It seems that pyvips doesn't handle the supplied parameter. I'm not sure if it's related to the fact that I omitted some possible parameters. If that's the case there is a sanity check missing.

As far as I can see and remember from working wit vips directly the layout option needs to be passed to dzsave...

Using large files causes the software to malfunction

The warning I got:
GLib-GObject-WARNING **: 06:08:26.898: value "16384" of type 'gint' is invalid or out of range for property 'tile-size' of type 'gint'

The command I used:
kubi -s 16384 -co tile_size=16384 -co depth=onetile -co overlap=0 -co layout=google -co suffix=.png -f l r u d f b originalFile.png englishHasStopped.dz

My image file was 65,536 * 32,768 (2^14 * 2^13)

Using large file sizes up to this point seems to be completely fine, so does the output for smaller tiling, as a tile size of 8192 would work just fine.

Despite the bug (which is kinda ridiculous and possibly just unintended use): Massive respect for writing the only software that could handle such large files that I could find!

No module named "_libvips"

Hello,

After installing kubi with pip I'm unable to run any commands because of the following error :

`ModuleNotFoundError: No module named '_libvips'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:\Users\Arthur\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 196, in _run_module_as_main
return run_code(code, main_globals, None,
File "C:\Users\Arthur\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 86, in run_code
exec(code, run_globals)
File "C:\Users\Arthur\AppData\Local\Programs\Python\Python310\Scripts\kubi.exe_main
.py", line 7, in
File "C:\Users\Arthur\AppData\Local\Programs\Python\Python310\lib\site-packages\kubi\kubi.py", line 347, in run
main(sys.argv[1:])
File "C:\Users\Arthur\AppData\Local\Programs\Python\Python310\lib\site-packages\kubi\kubi.py", line 343, in main
kubi(args)
File "C:\Users\Arthur\AppData\Local\Programs\Python\Python310\lib\site-packages\kubi\kubi.py", line 38, in kubi
import pyvips
File "C:\Users\Arthur\AppData\Local\Programs\Python\Python310\lib\site-packages\pyvips_init
.py", line 70, in
gobject_lib = ffi.dlopen(_gobject_libname)
File "C:\Users\Arthur\AppData\Local\Programs\Python\Python310\lib\site-packages\cffi\api.py", line 150, in dlopen
lib, function_cache = _make_ffi_library(self, name, flags)
File "C:\Users\Arthur\AppData\Local\Programs\Python\Python310\lib\site-packages\cffi\api.py", line 832, in _make_ffi_library
backendlib = _load_backend_lib(backend, libname, flags)
File "C:\Users\Arthur\AppData\Local\Programs\Python\Python310\lib\site-packages\cffi\api.py", line 827, in _load_backend_lib
raise OSError(msg)
OSError: cannot load library 'libgobject-2.0-0.dll': error 0x7e. Additionally, ctypes.util.find_library() did not manage to locate a library called 'libgobject-2.0-0.dll'`

I'm using python 3.10

Any suggestions?

thanks

Quality of tiles

How we can improve the image quality of tiles? right now it seems it is degrading the quality. even though we have tried 100% in Q parameter.

Let me know what am i doing wrong?

kubi -s 2048 -co tile_size=512 -co depth=onetile -co overlap=0 -co layout=google -co suffix=.jpg[Q=75] -f r l u d f b srcfile dstfile.dz

it seems tiles are generated with jpg thats why? @indus

Trouble passing -co arguments

Great library, thank you.

When I pass co arguments on linux and mac, Pyvips fails. Mac and linux.

Any tips greatly appreciated.

kubi -r lbb -f nx px py ny nz pz test.jpg test_out.jpg -co overlap=0

Traceback (most recent call last):
  File "/usr/local/bin/kubi", line 33, in <module>
    sys.exit(load_entry_point('kubi', 'console_scripts', 'kubi')())
  File "/usr/local/lib/python3.9/site-packages/kubi/kubi.py", line 343, in run
    main(sys.argv[1:])
  File "/usr/local/lib/python3.9/site-packages/kubi/kubi.py", line 339, in main
    kubi(args)
  File "/usr/local/lib/python3.9/site-packages/kubi/kubi.py", line 225, in kubi
    mapim.write_to_file(f'{dst}_{fn}{dst_ext}', **args.co)
  File "/usr/local/lib/python3.9/site-packages/pyvips/vimage.py", line 804, in write_to_file
    return pyvips.Operation.call(name, self, filename,
  File "/usr/local/lib/python3.9/site-packages/pyvips/voperation.py", line 288, in call
    raise Error('{0} does not support optional argument {1}'
pyvips.error.Error: VipsForeignSaveJpegFile does not support optional argument overlap

kubi -r lbb -f nx px py ny nz pz test.jpg test_out.jpg -co jpg

Traceback (most recent call last):
  File "/usr/local/bin/kubi", line 33, in <module>
    sys.exit(load_entry_point('kubi', 'console_scripts', 'kubi')())
  File "/usr/local/lib/python3.9/site-packages/kubi/kubi.py", line 343, in run
    main(sys.argv[1:])
  File "/usr/local/lib/python3.9/site-packages/kubi/kubi.py", line 339, in main
    kubi(args)
  File "/usr/local/lib/python3.9/site-packages/kubi/kubi.py", line 225, in kubi
    mapim.write_to_file(f'{dst}_{fn}{dst_ext}', **args.co)
  File "/usr/local/lib/python3.9/site-packages/pyvips/vimage.py", line 804, in write_to_file
    return pyvips.Operation.call(name, self, filename,
  File "/usr/local/lib/python3.9/site-packages/pyvips/voperation.py", line 288, in call
    raise Error('{0} does not support optional argument {1}'
pyvips.error.Error: VipsForeignSaveJpegFile does not support optional argument compression

UnboundLocalError

Hey! Excited to use this! Unfortunately, when I run it on the latest version of MacOS (2019 Intel MBP), I get this error regardless of the input params:

kubi <myFile.jpg> <myFileCM.jpg> results in:
UnboundLocalError: local variable 'pyvips' referenced before assignment

I made sure to install all of the related deps. I'm wondering if there is a step I'm missing?

Facing problem to run Kubi in shell script

Hi,

I have installed Kubi with python 3.6 and libvips by following this guide (https://tufora.com/tutorials/linux/general/install-vips-vips-tools-and-vips-devel-libvips-on-centos-7)

If i run kubi command in terminal, it is working fine.
However, when i run it in shell script it is having problem to load libvips.so.42
Is it some path setup missing in my shell script? Hope you can enlighten me on this.
Thanks.

Error Output: ================ 
Traceback (most recent call last): File "/usr/local/lib/python3.6/site-packages/pyvips/__init__.py", line 19, 
in import _libvips ModuleNotFoundError: No module named '_libvips' During handling of the above exception, 
another exception occurred: Traceback (most recent call last): File "/usr/local/bin/kubi", 
line 33, in sys.exit(load_entry_point('kubi==0.1.4', 'console_scripts', 'kubi')()) File "/usr/local/lib/python3.6/site-packages/kubi/kubi.py", 
line 335, in run main(sys.argv[1:]) File "/usr/local/lib/python3.6/site-packages/kubi/kubi.py", 
line 331, in main kubi(args) File "/usr/local/lib/python3.6/site-packages/kubi/kubi.py", 
line 38, in kubi import pyvips File "/usr/local/lib/python3.6/site-packages/pyvips/__init__.py", 
line 71, in vips_lib = ffi.dlopen(_vips_libname) File "/usr/local/lib64/python3.6/site-packages/cffi/api.py", 
line 150, in dlopen lib, function_cache = _make_ffi_library(self, name, flags) File "/usr/local/lib64/python3.6/site-packages/cffi/api.py", 
line 832, in _make_ffi_library backendlib = _load_backend_lib(backend, libname, flags) File "/usr/local/lib64/python3.6/site-packages/cffi/api.py",
line 827, in _load_backend_lib raise OSError(msg) OSError: cannot load library 'libvips.so.42': /lib64/libcairo.so.2: undefined symbol: FT_Get_Var_Design_Coordinates. Additionally, ctypes.util.find_library() did not manage to locate a library called 'libvips.so.42' 

1-pixel wide black line in generated +Y cube face image

platform: macOS 11.6
python version: 3.8.5
vips version: 8.12.2
pyvips version: 2.2.1
numpy version: 1.23.1
kubi version: master

First of all, thanks for developing kubi - it's super useful, especially for generating cube map images for use with Marzipano. I keep encountering a problem with all the images I try as inputs - the output +Y image always seemes to have a 1-pixel wide black line down the middle from the top to the center of the image, like in the image below:

basemap_cubemap_2

I think I've tracked the problem down to the way the x,y coordinates for the mapping image (for use with the vips mapim function) are generated. It seems that some of the pixel coordinates fall outide the bounds of the input image. Given an input image with dimentions of 4096x2049 pixels, the mapping for face +Y tried to access pixels at x coordinates 4096. Since image dimentions are zero-based, the maximum x coordinate would be 4095.

I shifted the linspace sample values by half a step on line 64, and this seems to have fixed the issue, and cube edges seem to line up more precisely now too:

Cubemap in Marzipano without the fix:
Screenshot 2022-07-20 at 19-47-33 Marzipano Tool

Cubemap in Marzipano with the fix applied:
Screenshot 2022-07-20 at 19-47-12 Marzipano Tool

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.