Commit 7a817dab authored by Alexander Alekhin's avatar Alexander Alekhin

Merge pull request #2398 from shimat:fix_xphoto_TonemapDurand_prop

parents d5b8115b a1cece73
......@@ -46,11 +46,11 @@ You need to set the OPENCV_ENABLE_NONFREE option in cmake to use those. Use them
@param contrast resulting contrast on logarithmic scale, i. e. log(max / min), where max and min
are maximum and minimum luminance values of the resulting image.
@param saturation saturation enhancement value. See createTonemapDrago
@param sigma_space bilateral filter sigma in color space
@param sigma_color bilateral filter sigma in coordinate space
@param sigma_color bilateral filter sigma in color space
@param sigma_space bilateral filter sigma in coordinate space
*/
CV_EXPORTS_W Ptr<TonemapDurand>
createTonemapDurand(float gamma = 1.0f, float contrast = 4.0f, float saturation = 1.0f, float sigma_space = 2.0f, float sigma_color = 2.0f);
createTonemapDurand(float gamma = 1.0f, float contrast = 4.0f, float saturation = 1.0f, float sigma_color = 2.0f, float sigma_space = 2.0f);
}} // namespace
#endif // OPENCV_XPHOTO_TONEMAP_HPP
......@@ -38,6 +38,34 @@ TEST(Photo_Tonemap, Durand_regression)
checkEqual(result, expected, 3, "Durand");
}
TEST(Photo_Tonemap, Durand_property_regression)
{
const float gamma = 1.0f;
const float contrast = 2.0f;
const float saturation = 3.0f;
const float sigma_color = 4.0f;
const float sigma_space = 5.0f;
const Ptr<TonemapDurand> durand1 = createTonemapDurand(gamma, contrast, saturation, sigma_color, sigma_space);
ASSERT_EQ(gamma, durand1->getGamma());
ASSERT_EQ(contrast, durand1->getContrast());
ASSERT_EQ(saturation, durand1->getSaturation());
ASSERT_EQ(sigma_space, durand1->getSigmaSpace());
ASSERT_EQ(sigma_color, durand1->getSigmaColor());
const Ptr<TonemapDurand> durand2 = createTonemapDurand();
durand2->setGamma(gamma);
durand2->setContrast(contrast);
durand2->setSaturation(saturation);
durand2->setSigmaColor(sigma_color);
durand2->setSigmaSpace(sigma_space);
ASSERT_EQ(gamma, durand2->getGamma());
ASSERT_EQ(contrast, durand2->getContrast());
ASSERT_EQ(saturation, durand2->getSaturation());
ASSERT_EQ(sigma_color, durand2->getSigmaColor());
ASSERT_EQ(sigma_space, durand2->getSigmaSpace());
}
#endif // OPENCV_ENABLE_NONFREE
}} // namespace
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment