From 47d71530a729eda8534920ab3c97ffcde2c3b992 Mon Sep 17 00:00:00 2001 From: Jay Pol <76426666+JayPol559@users.noreply.github.com> Date: Tue, 21 Oct 2025 15:00:58 +0530 Subject: [PATCH] Merge pull request #27866 from JayPol559:4.x Fix HDR tutorial result mismatch by adding gamma note #27866 This PR fixes #22219 by clarifying the gamma correction value in the HDR tutorial. The function cv.createTonemap() has a default gamma value of 1.0. To match the tutorial example results, gamma should be explicitly set to 2.2. This note has been added to the Tonemap HDR image section of the tutorial. --- doc/py_tutorials/py_photo/py_hdr/py_hdr.markdown | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/doc/py_tutorials/py_photo/py_hdr/py_hdr.markdown b/doc/py_tutorials/py_photo/py_hdr/py_hdr.markdown index 68788bde65..b06118b897 100644 --- a/doc/py_tutorials/py_photo/py_hdr/py_hdr.markdown +++ b/doc/py_tutorials/py_photo/py_hdr/py_hdr.markdown @@ -83,10 +83,15 @@ We map the 32-bit float HDR data into the range [0..1]. Actually, in some cases the values can be larger than 1 or lower the 0, so notice we will later have to clip the data in order to avoid overflow. +@note: The function `cv.createTonemap()` uses a default gamma value of 1.0. +Set it explicitly to 2.2 to match standard display brightness and ensure consistent tone mapping results. + + @code{.py} -# Tonemap HDR image +# Tonemap HDR images using gamma correction (set gamma=2.2 for standard display brightness) tonemap1 = cv.createTonemap(gamma=2.2) res_debevec = tonemap1.process(hdr_debevec.copy()) +res_robertson = tonemap1.process(hdr_robertson.copy()) @endcode ### 4. Merge exposures using Mertens fusion @@ -125,6 +130,8 @@ You can see the different results but consider that each algorithm have addition extra parameters that you should fit to get your desired outcome. Best practice is to try the different methods and see which one performs best for your scene. +The results below were generated with a gamma value of 2.2 during tonemapping. + ### Debevec: ![image](images/ldr_debevec.jpg)