opencv/samples
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
..
android Merge pull request #26698 from warped-rudi:mediandk2 2025-01-03 17:53:00 +03:00
cpp Merge pull request #27396 from abhishek-gola:hdr_bug_fix 2025-06-05 09:02:58 +03:00
data Fix data01.xml file for example_cpp_logistic_regression 2025-01-25 00:53:52 +03:00
directx Merge pull request #22462 from Biswa96:fix-directx-check 2022-10-03 08:37:36 +03:00
dnn Merge pull request #26614 from KangJialiang:fix-multi-channel-mean-scale-sample-dnn-yolo 2024-12-16 15:29:43 +03:00
gdb Merge pull request #21805 from rogday:pretty_fix 2022-04-20 04:55:04 +00:00
gpu Merge pull request #22615 from cudawarped:nvcuvenc 2022-10-28 11:03:51 +03:00
hal Fix configuring with CMake version 4 2025-04-02 13:45:08 -07:00
install fix 4.x links 2021-12-22 13:24:30 +00:00
java Backport C-API cleanup (imgproc) from 5.x 2023-01-16 23:29:50 +03:00
opencl samples: fix OpenCL events leaks 2020-05-14 17:15:09 +00:00
opengl Merge pull request #26815 from shyama7004:fix-deprecation 2025-01-22 13:53:59 +03:00
openvx Fix configuring with CMake version 4 2025-04-02 13:45:08 -07:00
python Merge pull request #27396 from abhishek-gola:hdr_bug_fix 2025-06-05 09:02:58 +03:00
semihosting fix 4.x links 2021-12-22 13:24:30 +00:00
swift/ios Update tests and samples to work with changes to dynamic build 2020-09-27 21:12:28 +09:00
sycl ocl: fixes for OpenCL multiple contexts support 2020-09-03 20:34:49 +00:00
tapi Merge pull request #19755 from mikhail-nikolskiy:ffmpeg-umat 2021-05-14 16:48:50 +00:00
va_intel samples(va): fix build warnings, use cv::format() 2021-02-19 10:36:26 +00:00
winrt Fix some typos in platforms/, samples/, 3rdparty/. 2022-09-07 16:09:23 +03:00
winrt_universal samples: avoid using of legacy C-like API (part 2) 2018-03-29 14:17:23 +03:00
wp8 Merge pull request #20223 from jogo-:3.4_wp8_samples_typos 2021-06-07 17:32:14 +00:00
_winpack_build_sample.cmd Merge remote-tracking branch 'upstream/3.4' into merge-3.4 2020-05-18 17:50:16 +00:00
_winpack_run_python_sample.cmd samples: add Python 3.12 2023-12-20 21:32:46 +03:00
CMakeLists.example.in Fix configuring with CMake version 4 2025-04-02 13:45:08 -07:00
CMakeLists.txt Fix configuring with CMake version 4 2025-04-02 13:45:08 -07:00
samples_utils.cmake imgproc: add IntelligentScissors 2020-12-25 10:57:11 +00:00