Open Source Computer Vision Library
Go to file
Abhishek Gola aef6ae4872
Merge pull request #27396 from abhishek-gola:hdr_bug_fix
Fix NaNs in HDR Triangle Weights and Tonemapping and Update LDR Ground Truth in tutorial #27396

The PR closes #27392 

Updated the triangle weights to use a small epsilon value instead of zero to prevent NaN issues in HDR processing.
Also fixed a float-to-double division issue by explicitly casting double values to float, which was previously producing garbage values and leading to NaNs in tonemapping.

The current LDR ground truth image used in the tutorial [ldr.png](https://github.com/opencv/opencv/blob/4.x/doc/tutorials/others/images/ldr.png) was originally generated using TonemapDurand (check this commit 833f8d16fa), which was moved to opencv_contrib a long time ago in this commit: 742f22c09b. However, the current Tonemap implementation in OpenCV main only performs normalization and gamma correction, which produces noticeably different results. This PR updates the LDR grouth truth image in tutorial with the result of TonemapDrago, and tutorials to use TonemapDrago as Tonemap gives a darker image.

Tonemap output:
![ldr2](https://github.com/user-attachments/assets/e4f0cb97-ee4f-47b9-8962-2020ff211fd5)

TonemapDrago output:
![ldr](https://github.com/user-attachments/assets/4a898101-22bd-49e5-8db0-9e1062974ba3)


### Pull Request Readiness Checklist

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

- [x] I agree to contribute to the project under Apache 2 License.
- [x] 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
- [x] The PR is proposed to the proper branch
- [x] There is a reference to the original bug report and related work
- [x] There is accuracy test, performance test and test data in opencv_extra repository, if applicable
      Patch to opencv_extra has the same branch name.
- [x] The feature is well documented and sample code can be built with the project CMake
2025-06-05 09:02:58 +03:00
.github Removed Android test as it's broken for now. 2025-02-18 12:52:24 +03:00
3rdparty Merge pull request #27343 from fengyuentau:4x/build/fix_more_warnings 2025-05-21 16:12:09 +03:00
apps Merge pull request #27338 from omahs:patch-1 2025-05-21 12:13:50 +03:00
cmake Try to add FastCV to OpenCV4AndroidSDK 2025-05-24 18:49:11 +03:00
data Merge pull request #22727 from su77ungr:patch-1 2022-11-17 06:54:25 +00:00
doc Merge pull request #27396 from abhishek-gola:hdr_bug_fix 2025-06-05 09:02:58 +03:00
hal Added default copyright header to IPP HAL. 2025-05-24 16:57:49 +03:00
include exclude opencv_contrib modules 2020-02-26 15:12:45 +03:00
modules Merge pull request #27396 from abhishek-gola:hdr_bug_fix 2025-06-05 09:02:58 +03:00
platforms Try to add FastCV to OpenCV4AndroidSDK 2025-05-24 18:49:11 +03:00
samples Merge pull request #27396 from abhishek-gola:hdr_bug_fix 2025-06-05 09:02:58 +03:00
.editorconfig add .editorconfig 2018-10-11 17:57:51 +00:00
.gitattributes cmake: generate and install ffmpeg-download.ps1 2018-06-09 13:19:48 +03:00
.gitignore Merge pull request #17165 from komakai:objc-binding 2020-06-08 18:32:53 +00:00
CMakeLists.txt Merge pull request #27301 from fengyuentau:4x/hal/riscv_rvv/refactor_build 2025-05-14 14:04:58 +03:00
CONTRIBUTING.md migration: github.com/opencv/opencv 2016-07-12 12:51:12 +03:00
COPYRIGHT copyright: 2023 (update) 2023-01-09 09:49:22 +00:00
LICENSE Merge pull request #18073 from vpisarev:apache2_license 2020-08-17 11:49:11 +00:00
README.md Space mistake in README.md 2024-03-03 23:37:07 +05:30
SECURITY.md Updated PGP key for security reports 2023-04-19 19:16:55 +03:00

OpenCV: Open Source Computer Vision Library

Resources

Contributing

Please read the contribution guidelines before starting work on a pull request.

Summary of the guidelines:

  • One pull request per issue;
  • Choose the right base branch;
  • Include tests and documentation;
  • Clean up "oops" commits before submitting;
  • Follow the coding style guide.

Additional Resources