提交 78a0b978 编写于 作者: V Vadim Pisarevsky

fixed build errors on Mac; moved test for #2332 from imgproc to highgui

上级 460644b8
......@@ -85,6 +85,7 @@
#include <omp.h>
#elif defined HAVE_GCD
#include <dispatch/dispatch.h>
#include <sys/sysctl.h>
#include <pthread.h>
#elif defined HAVE_CONCURRENCY
#include <ppl.h>
......@@ -371,7 +372,7 @@ int cv::getThreadNum(void)
#elif defined HAVE_OPENMP
return omp_get_thread_num();
#elif defined HAVE_GCD
return statc_cast<int>(pthread_self()); // no zero-based indexing
return (int)(size_t)(void*)pthread_self(); // no zero-based indexing
#elif defined HAVE_CONCURRENCY
return std::max(0, (int)Concurrency::Context::VirtualProcessorId()); // zero for master thread, unique number for others but not necessary 1,2,3,...
#else
......
......@@ -255,3 +255,31 @@ public:
TEST(Highgui_Image, encode_png) { CV_GrfmtPNGEncodeTest test; test.safe_run(); }
#endif
#ifdef HAVE_JPEG
TEST(Highgui_ImreadVSCvtColor, regression)
{
cvtest::TS& ts = *cvtest::TS::ptr();
const int MAX_MEAN_DIFF = 3;
const int MAX_ABS_DIFF = 10;
string imgName = string(ts.get_data_path()) + "/../cv/shared/lena.jpg";
Mat original_image = imread(imgName);
Mat gray_by_codec = imread(imgName, 0);
Mat gray_by_cvt;
cvtColor(original_image, gray_by_cvt, CV_BGR2GRAY);
Mat diff;
absdiff(gray_by_codec, gray_by_cvt, diff);
double actual_avg_diff = (double)mean(diff)[0];
double actual_maxval, actual_minval;
minMaxLoc(diff, &actual_minval, &actual_maxval);
EXPECT_LT(actual_avg_diff, MAX_MEAN_DIFF);
EXPECT_LT(actual_maxval, MAX_ABS_DIFF);
}
#endif
......@@ -1683,31 +1683,6 @@ TEST(Imgproc_ColorLuv, accuracy) { CV_ColorLuvTest test; test.safe_run(); }
TEST(Imgproc_ColorRGB, accuracy) { CV_ColorRGBTest test; test.safe_run(); }
TEST(Imgproc_ColorBayer, accuracy) { CV_ColorBayerTest test; test.safe_run(); }
TEST(Imgproc_ImreadVSCvtColor, regression)
{
cvtest::TS& ts = *cvtest::TS::ptr();
const int MAX_MEAN_DIFF = 3;
const int MAX_ABS_DIFF = 10;
string imgName = string(ts.get_data_path()) + "/shared/lena.jpg";
Mat original_image = imread(imgName);
Mat gray_by_codec = imread(imgName, 0);
Mat gray_by_cvt;
cvtColor(original_image, gray_by_cvt, CV_BGR2GRAY);
Mat diff;
absdiff(gray_by_codec, gray_by_cvt, diff);
double actual_avg_diff = (double)sum(diff)[0] / countNonZero(diff);
double actual_maxval, actual_minval;
minMaxLoc(diff, &actual_minval, &actual_maxval);
EXPECT_LT(actual_avg_diff, MAX_MEAN_DIFF);
EXPECT_LT(actual_maxval, MAX_ABS_DIFF);
}
TEST(Imgproc_ColorBayer, regression)
{
cvtest::TS& ts = *cvtest::TS::ptr();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册