Skip to content

Commit 7a817da

Browse files
committed
Merge pull request #2398 from shimat:fix_xphoto_TonemapDurand_prop
2 parents d5b8115 + a1cece7 commit 7a817da

File tree

2 files changed

+31
-3
lines changed

2 files changed

+31
-3
lines changed

modules/xphoto/include/opencv2/xphoto/tonemap.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,11 @@ You need to set the OPENCV_ENABLE_NONFREE option in cmake to use those. Use them
4646
@param contrast resulting contrast on logarithmic scale, i. e. log(max / min), where max and min
4747
are maximum and minimum luminance values of the resulting image.
4848
@param saturation saturation enhancement value. See createTonemapDrago
49-
@param sigma_space bilateral filter sigma in color space
50-
@param sigma_color bilateral filter sigma in coordinate space
49+
@param sigma_color bilateral filter sigma in color space
50+
@param sigma_space bilateral filter sigma in coordinate space
5151
*/
5252
CV_EXPORTS_W Ptr<TonemapDurand>
53-
createTonemapDurand(float gamma = 1.0f, float contrast = 4.0f, float saturation = 1.0f, float sigma_space = 2.0f, float sigma_color = 2.0f);
53+
createTonemapDurand(float gamma = 1.0f, float contrast = 4.0f, float saturation = 1.0f, float sigma_color = 2.0f, float sigma_space = 2.0f);
5454

5555
}} // namespace
5656
#endif // OPENCV_XPHOTO_TONEMAP_HPP

modules/xphoto/test/test_hdr.cpp

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,34 @@ TEST(Photo_Tonemap, Durand_regression)
3838
checkEqual(result, expected, 3, "Durand");
3939
}
4040

41+
TEST(Photo_Tonemap, Durand_property_regression)
42+
{
43+
const float gamma = 1.0f;
44+
const float contrast = 2.0f;
45+
const float saturation = 3.0f;
46+
const float sigma_color = 4.0f;
47+
const float sigma_space = 5.0f;
48+
49+
const Ptr<TonemapDurand> durand1 = createTonemapDurand(gamma, contrast, saturation, sigma_color, sigma_space);
50+
ASSERT_EQ(gamma, durand1->getGamma());
51+
ASSERT_EQ(contrast, durand1->getContrast());
52+
ASSERT_EQ(saturation, durand1->getSaturation());
53+
ASSERT_EQ(sigma_space, durand1->getSigmaSpace());
54+
ASSERT_EQ(sigma_color, durand1->getSigmaColor());
55+
56+
const Ptr<TonemapDurand> durand2 = createTonemapDurand();
57+
durand2->setGamma(gamma);
58+
durand2->setContrast(contrast);
59+
durand2->setSaturation(saturation);
60+
durand2->setSigmaColor(sigma_color);
61+
durand2->setSigmaSpace(sigma_space);
62+
ASSERT_EQ(gamma, durand2->getGamma());
63+
ASSERT_EQ(contrast, durand2->getContrast());
64+
ASSERT_EQ(saturation, durand2->getSaturation());
65+
ASSERT_EQ(sigma_color, durand2->getSigmaColor());
66+
ASSERT_EQ(sigma_space, durand2->getSigmaSpace());
67+
}
68+
4169
#endif // OPENCV_ENABLE_NONFREE
4270

4371
}} // namespace

0 commit comments

Comments
 (0)