Commit 62ee92e3 authored by Rostislav Vasilikhin's avatar Rostislav Vasilikhin

ColorLab_full test fixed

parent 375ec5ed
...@@ -2297,7 +2297,7 @@ static void validateResult(const Mat& reference, const Mat& actual, const Mat& s ...@@ -2297,7 +2297,7 @@ static void validateResult(const Mat& reference, const Mat& actual, const Mat& s
ssize.width *= cn; ssize.width *= cn;
bool next = true; bool next = true;
//RGB2Lab_f works throug LUT and brings additional error //RGB2Lab_f works throug LUT and brings additional error
static const float maxErr = 1.f/200.f; static const float maxErr = 1.f/192.f;
for (int y = 0; y < ssize.height && next; ++y) for (int y = 0; y < ssize.height && next; ++y)
{ {
...@@ -2335,20 +2335,22 @@ TEST(Imgproc_ColorLab_Full, accuracy) ...@@ -2335,20 +2335,22 @@ TEST(Imgproc_ColorLab_Full, accuracy)
Size ssize = src.size(); Size ssize = src.size();
CV_Assert(ssize.width == ssize.height); CV_Assert(ssize.width == ssize.height);
RNG& rng = cvtest::TS::ptr()->get_rng(); for(int i = 0; i < 4; i++)
int blueInd = rng.uniform(0., 1.) > 0.5 ? 0 : 2; {
bool srgb = rng.uniform(0., 1.) > 0.5; int blueInd = (i%2) > 0 ? 0 : 2;
bool srgb = i > 1;
// Convert test image to LAB
cv::Mat lab; // Convert test image to LAB
int forward_code = blueInd ? srgb ? CV_BGR2Lab : CV_LBGR2Lab : srgb ? CV_RGB2Lab : CV_LRGB2Lab; cv::Mat lab;
int inverse_code = blueInd ? srgb ? CV_Lab2BGR : CV_Lab2LBGR : srgb ? CV_Lab2RGB : CV_Lab2LRGB; int forward_code = blueInd ? srgb ? CV_BGR2Lab : CV_LBGR2Lab : srgb ? CV_RGB2Lab : CV_LRGB2Lab;
cv::cvtColor(src, lab, forward_code); int inverse_code = blueInd ? srgb ? CV_Lab2BGR : CV_Lab2LBGR : srgb ? CV_Lab2RGB : CV_Lab2LRGB;
// Convert LAB image back to BGR(RGB) cv::cvtColor(src, lab, forward_code);
cv::Mat recons; // Convert LAB image back to BGR(RGB)
cv::cvtColor(lab, recons, inverse_code); cv::Mat recons;
cv::cvtColor(lab, recons, inverse_code);
validateResult(src, recons, src, forward_code);
validateResult(src, recons, src, forward_code);
}
} }
static void test_Bayer2RGB_EdgeAware_8u(const Mat& src, Mat& dst, int code) static void test_Bayer2RGB_EdgeAware_8u(const Mat& src, Mat& dst, int code)
......
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
#include "opencv2/core/private.hpp" #include "opencv2/core/private.hpp"
#include "opencv2/imgproc.hpp" #include "opencv2/imgproc.hpp"
#include "opencv2/imgcodecs.hpp" #include "opencv2/imgcodecs.hpp"
#include "opencv2/core/softfloat.hpp"
#include "opencv2/imgproc/imgproc_c.h" #include "opencv2/imgproc/imgproc_c.h"
......
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