sunset1995 / py360convert

Python implementation of convertion between equirectangular, cubemap and perspective. (equirect2cube, cube2equirect, equirect2perspec)
MIT License
443 stars 97 forks source link

Problem with Py360Convert and Pillow #21

Open xXxjubeixXx opened 1 year ago

xXxjubeixXx commented 1 year ago

When I play the code on Python it gives me this error and I think it is a problem with PIL

/bin/python3 "/home/jubei/Documentos/Python/Images 360/equiretangular.py"
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/PIL/Image.py", line 2813, in fromarray
    mode, rawmode = _fromarray_typemap[typekey]
KeyError: ((1, 1, 3), '<f8')

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/jubei/Documentos/Python/Images 360/equiretangular.py", line 9, in <module>
    image = Image.fromarray(equiretangular)
  File "/usr/lib/python3/dist-packages/PIL/Image.py", line 2815, in fromarray
    raise TypeError("Cannot handle this data type: %s, %s" % typekey) from e
TypeError: Cannot handle this data type: (1, 1, 3), <f8
PerrinAntonin commented 1 year ago

you need to convert the image to unint8

equirec = np.clip(equirec, 0, 255).astype(np.uint8)