image icon indicating copy to clipboard operation
image copied to clipboard

Support for single-channel f32 grayscale images?

Open stephanemagnenat opened this issue 2 years ago • 2 comments
trafficstars

It is common in computer vision to have grayscale images with a single f32 channel, for example the Akaze feature detector in OpenCV uses that. Formats such as OpenEXR and related exr library in Rust support that.

However, currently the ColorType doesn't support it. This prevents a simple use of image to save images in this format. I believe that it would be helpful to add support for that (that would be a L32F). Is there an interest or plan for such addition?

stephanemagnenat avatar Jun 06 '23 11:06 stephanemagnenat

At some point I'd like to enable saving images with formats beyond those in ColorType which would resolve this without needing to add more core color types to the library. See https://github.com/image-rs/image/issues/1849#issuecomment-1423631926

A lot of the hesitance comes from wanting to keep the list of DynamicImage variants in sync with the values of ColorType

fintelia avatar Jun 07 '23 02:06 fintelia

I see! Yes, that makes sense, from my point of view the goal is not to have an over-fat DynamicImage but to have convenient features on ImageBuffer. Currently, saving a ImageBuffer<Luma<f32>, Vec<f32>> to an EXR file fails, and that is what I would expect to succeed.

Should I rename this issue or create a new one to focus on saving/loading of such?

stephanemagnenat avatar Jun 07 '23 07:06 stephanemagnenat