Skip to content

EXR alpha support for 4 channel reading and writing#19655

Merged
alalek merged 1 commit intoopencv:3.4from
raaldrid:EXR_rw_alpha_support_16115
Mar 5, 2021
Merged

EXR alpha support for 4 channel reading and writing#19655
alalek merged 1 commit intoopencv:3.4from
raaldrid:EXR_rw_alpha_support_16115

Conversation

@raaldrid
Copy link
Copy Markdown
Contributor

@raaldrid raaldrid commented Mar 1, 2021

Merge with extra: opencv/opencv_extra#859

EXR alpha support for 4 channel reading and writing. Issue #16115.
Replaced magic numbers (3 and 4) with const variables where possible to enhance readability and mantainability.

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 other license that is incompatible with OpenCV
  • The PR is proposed to proper branch
  • There is reference to 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

@raaldrid raaldrid force-pushed the EXR_rw_alpha_support_16115 branch from 9bde4a5 to 9784b39 Compare March 1, 2021 19:21
@asmorkalov asmorkalov changed the title EXR alpha support for 4 channel reading and writing. Issue https://g… EXR alpha support for 4 channel reading and writing Mar 2, 2021
{
const string root = cvtest::TS::ptr()->get_data_path();
const string filenameInput = root + "readwrite/test_YRYBYA.exr";
const string filenameOutput = root + "readwrite/test_YRYBYA.written.removedalpha.exr";
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Tests should not write to testdata location by default. It may be mounted in read-only mode (and shared between validation build instances).

Consider using GENERATE_DATA approach to generate test data (write to testdata location "locally" and then commit generated files).
Use cv::tempfile() to generate names for temporary files.

You need to open PR in opencv_extra (with the same source branch name EXR_rw_alpha_support_16115), not in your fork.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thank you @alalek. Good points. I see the issue with writing to testdata location. I updated to write to cv::tempfile() location & name.

I updated the code to use GENERATE_DATA for the RGBA test case (and committed a generated RGBA test image to opencv_extra). GENERATE_DATA will not work for YA or YRYBY(A) test images as the current EXR write only supports RGB(A) or Y (all input chroma files are convereted to RGB(A) or Y(A) on read), and loadsave doesn't support YA (2 channel) write.

I believe I updated the opencv_extra PR as instructed: opencv/opencv_extra#859

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Hi @alalek. Are there further changes to my PR you would like to see?
Thank you.

@raaldrid raaldrid force-pushed the EXR_rw_alpha_support_16115 branch from 30845b8 to cc22a73 Compare March 2, 2021 19:50
Copy link
Copy Markdown
Member

@alalek alalek left a comment

Choose a reason for hiding this comment

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

Well done! Thank you 👍

@alalek alalek merged commit a1e2c4f into opencv:3.4 Mar 5, 2021
@alalek alalek mentioned this pull request Mar 6, 2021
@alalek alalek mentioned this pull request Apr 9, 2021
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.

EXR read/write not supporting alpha channel

2 participants