Commit a8b1abcb authored by Seon-Wook Park's avatar Seon-Wook Park

Add basic perf tests for grayworld

parent dea8aae2
#include "perf_precomp.hpp"
using namespace std;
using namespace cv;
using namespace perf;
typedef std::tr1::tuple<Size, float> Size_WBThresh_t;
typedef perf::TestBaseWithParam<Size_WBThresh_t> Size_WBThresh;
PERF_TEST_P( Size_WBThresh, autowbGrayworld,
testing::Combine(
testing::Values( TYPICAL_MAT_SIZES ),
testing::Values( 0.1, 0.5, 1.0 )
)
)
{
Size size = std::tr1::get<0>(GetParam());
float wb_thresh = std::tr1::get<1>(GetParam());
Mat src(size, CV_8UC3);
Mat dst(size, CV_8UC3);
declare.in(src, WARMUP_RNG).out(dst);
TEST_CYCLE() xphoto::autowbGrayworld(src, dst, wb_thresh);
SANITY_CHECK(dst);
}
#include "perf_precomp.hpp"
CV_PERF_TEST_MAIN(xphoto)
#ifdef __GNUC__
# pragma GCC diagnostic ignored "-Wmissing-declarations"
# if defined __clang__ || defined __APPLE__
# pragma GCC diagnostic ignored "-Wmissing-prototypes"
# pragma GCC diagnostic ignored "-Wextra"
# endif
#endif
#ifndef __OPENCV_PERF_PRECOMP_HPP__
#define __OPENCV_PERF_PRECOMP_HPP__
#include "opencv2/ts.hpp"
#include "opencv2/xphoto.hpp"
#ifdef GTEST_CREATE_SHARED_LIBRARY
#error no modules except ts should have GTEST_CREATE_SHARED_LIBRARY defined
#endif
#endif
......@@ -67,7 +67,7 @@ namespace cv { namespace xphoto {
// Calculate sum of pixel values of each channel
const uchar* src_data = src.ptr<uchar>(0);
ulong sum1 = 0, sum2 = 0, sum3 = 0;
unsigned long sum1 = 0, sum2 = 0, sum3 = 0;
int i = 0;
#if CV_SIMD128
v_uint8x16 v_inB, v_inG, v_inR;
......@@ -165,9 +165,9 @@ namespace cv { namespace xphoto {
// Scale by maximum
if ( inv_max > 0 )
{
inv1 /= inv_max;
inv2 /= inv_max;
inv3 /= inv_max;
inv1 = (float)((double)inv1 / inv_max);
inv2 = (float)((double)inv2 / inv_max);
inv3 = (float)((double)inv3 / inv_max);
}
// Scale input pixel values
......@@ -225,9 +225,9 @@ namespace cv { namespace xphoto {
#endif
for ( ; i < N3; i += 3 )
{
dst_data[i + 0] = src_data[i + 0] * inv1;
dst_data[i + 1] = src_data[i + 1] * inv2;
dst_data[i + 2] = src_data[i + 2] * inv3;
dst_data[i + 0] = (uchar)(src_data[i + 0] * inv1);
dst_data[i + 1] = (uchar)(src_data[i + 1] * inv2);
dst_data[i + 2] = (uchar)(src_data[i + 2] * inv3);
}
}
......
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