strukturag / libheif

libheif is an HEIF and AVIF file format decoder and encoder.
Other
1.73k stars 299 forks source link

Feature request: 16b output #910

Open Pizzanomicon opened 1 year ago

Pizzanomicon commented 1 year ago

I believe depth maps are stored in more than 8b from an iPhone, I'm able to see a far less quantized depth map when using Focos (though still unable to output said depth map at that bitdepth), I believe adding libtiff support and allowing for 16bit output would greatly improve the usability of this already exceptional library.

Is 16b image output on the roadmap?

Thank you for all your work on this.

farindk commented 1 year ago

Could you please attach an example image?

kmilos commented 1 year ago

I believe adding libtiff support

Not strictly necessary to increase complexity with this, as libpng already supports 16b. And even exporting to the simplest format like PGM/PPM can be useful...

seismosmsr commented 1 year ago

@farindk

See attached.

16bit depth data seems to be the standard with the current generation of iphones.

CAP_B25DFFE5-A83E-4201-B0DD-3AC45C71D3ED.zip

I've tried reading this with GDAL which depends on libheif for its HEIC driver.

farindk commented 1 year ago

I've looked at the file. The depth map is stored with JPEG compression. Now, libheif just added support for JPEG compressed images in the HEIF, but this file uses lossless JPEG compression, which is not supported by libjpeg (or libjpeg-turbo). Thus, the decoding of the depth image fails.

Depth-images compressed with a supported codec should also work with 16 bit.

The metadata in the file says that it was generated on an iPhone 12. Is this correct or was it modified further by a different software?