Skip to content

imgcodecs: OpenEXR multispectral read/write support #27485

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: 4.x
Choose a base branch
from

Conversation

xaos-cz
Copy link
Contributor

@xaos-cz xaos-cz commented Jun 26, 2025

OpenCV Extra: opencv/opencv_extra#1262

Adds capability to read and write multispectral (>4 channels) images in OpenEXR format.

Pull Request Readiness Checklist

See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request

  • I agree to contribute to the project under Apache 2 License.
  • To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV
  • The PR is proposed to the proper branch
  • There is a reference to the original bug report and related work
  • There is accuracy test, performance test and test data in opencv_extra repository, if applicable
    Patch to opencv_extra has the same branch name.
  • The feature is well documented and sample code can be built with the project CMake

xaos-cz added 2 commits June 26, 2025 15:33
Adds capability to read and write multispectral (>4 channels) images in OpenEXR format.
solving warning C4800
@vpisarev vpisarev self-requested a review June 27, 2025 07:07
const string filenameInput = root + "readwrite/test32FC7.exr";
const string filenameOutput = cv::tempfile(".exr");
#ifndef GENERATE_DATA
const Mat img = cv::imread(filenameInput, IMREAD_UNCHANGED);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How will it work in case of BGR or GRAYSCALE input?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried to open the test file without parameters and got [ERROR:0@0.020] global loadsave.cpp:515 imread_ imread_('./test32FC7.exr'): can't read data: OpenCV(4.12.0-pre) /mnt/Projects/Projects/opencv/modules/imgcodecs/src/grfmt_exr.cpp:258: error: (-215:Assertion failed) m_multispectral == multispectral in function 'readData'

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The message looks cryptic. I propose to use CV_CheckXXX macro and add meaningful error message.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How will it work in case of BGR or GRAYSCALE input?

It leaves it on previous implementation when channels <= 4

Copy link
Contributor Author

@xaos-cz xaos-cz Jun 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried to open the test file without parameters and got `[ERROR:0@0.020] ...

I will test it today and add some error messages.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy