Merge remote-tracking branch 'origin/2.4'
Conflicts: 3rdparty/ffmpeg/ffmpeg_version.cmake cmake/OpenCVFindLibsGrfmt.cmake cmake/templates/cvconfig.h.cmake modules/bioinspired/doc/retina/index.rst modules/calib3d/doc/camera_calibration_and_3d_reconstruction.rst modules/calib3d/src/precomp.hpp modules/contrib/src/inputoutput.cpp modules/contrib/src/precomp.hpp modules/core/include/opencv2/core/internal.hpp modules/core/include/opencv2/core/types_c.h modules/core/src/drawing.cpp modules/core/src/precomp.hpp modules/core/src/system.cpp modules/features2d/doc/common_interfaces_of_descriptor_matchers.rst modules/features2d/doc/common_interfaces_of_feature_detectors.rst modules/features2d/include/opencv2/features2d/features2d.hpp modules/features2d/src/precomp.hpp modules/flann/src/precomp.hpp modules/gpu/doc/camera_calibration_and_3d_reconstruction.rst modules/gpu/doc/image_filtering.rst modules/gpu/doc/image_processing.rst modules/gpu/doc/video.rst modules/gpu/perf/perf_imgproc.cpp modules/gpu/perf4au/main.cpp modules/gpu/src/imgproc.cpp modules/gpu/src/precomp.hpp modules/gpu/test/test_imgproc.cpp modules/highgui/CMakeLists.txt modules/highgui/test/test_precomp.hpp modules/imgproc/doc/structural_analysis_and_shape_descriptors.rst modules/imgproc/src/precomp.hpp modules/java/generator/src/cpp/Mat.cpp modules/legacy/src/precomp.hpp modules/ml/doc/k_nearest_neighbors.rst modules/ml/src/precomp.hpp modules/nonfree/doc/feature_detection.rst modules/nonfree/src/precomp.hpp modules/objdetect/include/opencv2/objdetect/objdetect.hpp modules/objdetect/src/cascadedetect.cpp modules/objdetect/src/hog.cpp modules/objdetect/src/precomp.hpp modules/objdetect/test/test_latentsvmdetector.cpp modules/ocl/src/hog.cpp modules/ocl/src/opencl/objdetect_hog.cl modules/ocl/src/precomp.hpp modules/photo/src/precomp.hpp modules/stitching/src/precomp.hpp modules/superres/perf/perf_precomp.hpp modules/superres/src/optical_flow.cpp modules/superres/src/precomp.hpp modules/superres/test/test_precomp.hpp modules/ts/include/opencv2/ts.hpp modules/video/src/precomp.hpp modules/videostab/src/precomp.hpp modules/world/src/precomp.hpp
This commit is contained in:
@@ -49,13 +49,16 @@ using namespace cvtest;
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// HistEven
|
||||
|
||||
struct HistEven : testing::TestWithParam<cv::gpu::DeviceInfo>
|
||||
PARAM_TEST_CASE(HistEven, cv::gpu::DeviceInfo, cv::Size)
|
||||
{
|
||||
cv::gpu::DeviceInfo devInfo;
|
||||
|
||||
cv::Size size;
|
||||
|
||||
virtual void SetUp()
|
||||
{
|
||||
devInfo = GetParam();
|
||||
devInfo = GET_PARAM(0);
|
||||
size = GET_PARAM(1);
|
||||
|
||||
cv::gpu::setDevice(devInfo.deviceID());
|
||||
}
|
||||
@@ -63,57 +66,34 @@ struct HistEven : testing::TestWithParam<cv::gpu::DeviceInfo>
|
||||
|
||||
GPU_TEST_P(HistEven, Accuracy)
|
||||
{
|
||||
cv::Mat img = readImage("stereobm/aloe-L.png");
|
||||
ASSERT_FALSE(img.empty());
|
||||
|
||||
cv::Mat hsv;
|
||||
cv::cvtColor(img, hsv, cv::COLOR_BGR2HSV);
|
||||
cv::Mat src = randomMat(size, CV_8UC1);
|
||||
|
||||
int hbins = 30;
|
||||
float hranges[] = {0.0f, 180.0f};
|
||||
|
||||
std::vector<cv::Mat> srcs;
|
||||
cv::split(hsv, srcs);
|
||||
float hranges[] = {50.0f, 200.0f};
|
||||
|
||||
cv::gpu::GpuMat hist;
|
||||
cv::gpu::histEven(loadMat(srcs[0]), hist, hbins, (int)hranges[0], (int)hranges[1]);
|
||||
cv::gpu::histEven(loadMat(src), hist, hbins, (int) hranges[0], (int) hranges[1]);
|
||||
|
||||
cv::Mat hist_gold;
|
||||
|
||||
cv::MatND histnd;
|
||||
int histSize[] = {hbins};
|
||||
const float* ranges[] = {hranges};
|
||||
int channels[] = {0};
|
||||
cv::calcHist(&hsv, 1, channels, cv::Mat(), histnd, 1, histSize, ranges);
|
||||
cv::calcHist(&src, 1, channels, cv::Mat(), hist_gold, 1, histSize, ranges);
|
||||
|
||||
cv::Mat hist_gold = histnd;
|
||||
hist_gold = hist_gold.t();
|
||||
hist_gold.convertTo(hist_gold, CV_32S);
|
||||
|
||||
EXPECT_MAT_NEAR(hist_gold, hist, 0.0);
|
||||
}
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(GPU_ImgProc, HistEven, ALL_DEVICES);
|
||||
INSTANTIATE_TEST_CASE_P(GPU_ImgProc, HistEven, testing::Combine(
|
||||
ALL_DEVICES,
|
||||
DIFFERENT_SIZES));
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// CalcHist
|
||||
|
||||
namespace
|
||||
{
|
||||
void calcHistGold(const cv::Mat& src, cv::Mat& hist)
|
||||
{
|
||||
hist.create(1, 256, CV_32SC1);
|
||||
hist.setTo(cv::Scalar::all(0));
|
||||
|
||||
int* hist_row = hist.ptr<int>();
|
||||
for (int y = 0; y < src.rows; ++y)
|
||||
{
|
||||
const uchar* src_row = src.ptr(y);
|
||||
|
||||
for (int x = 0; x < src.cols; ++x)
|
||||
++hist_row[src_row[x]];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
PARAM_TEST_CASE(CalcHist, cv::gpu::DeviceInfo, cv::Size)
|
||||
{
|
||||
cv::gpu::DeviceInfo devInfo;
|
||||
@@ -137,7 +117,16 @@ GPU_TEST_P(CalcHist, Accuracy)
|
||||
cv::gpu::calcHist(loadMat(src), hist);
|
||||
|
||||
cv::Mat hist_gold;
|
||||
calcHistGold(src, hist_gold);
|
||||
|
||||
const int hbins = 256;
|
||||
const float hranges[] = {0.0f, 256.0f};
|
||||
const int histSize[] = {hbins};
|
||||
const float* ranges[] = {hranges};
|
||||
const int channels[] = {0};
|
||||
|
||||
cv::calcHist(&src, 1, channels, cv::Mat(), hist_gold, 1, histSize, ranges);
|
||||
hist_gold = hist_gold.reshape(1, 1);
|
||||
hist_gold.convertTo(hist_gold, CV_32S);
|
||||
|
||||
EXPECT_MAT_NEAR(hist_gold, hist, 0.0);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user