author | Roman Donchenko <roman.donchenko@itseez.com> | |
Mon, 17 Feb 2014 11:24:05 +0000 (15:24 +0400) | ||
committer | Roman Donchenko <roman.donchenko@itseez.com> | |
Mon, 17 Feb 2014 11:24:05 +0000 (15:24 +0400) |
Conflicts:
modules/core/src/gl_core_3_1.cpp
modules/core/src/opencl/convert.cl
modules/cudaimgproc/src/cuda/canny.cu
modules/cudastereo/perf/perf_stereo.cpp
modules/gpu/perf/perf_imgproc.cpp
modules/gpu/test/test_denoising.cpp
modules/ocl/src/opencl/imgproc_resize.cl
samples/cpp/Qt_sample/main.cpp
modules/core/src/gl_core_3_1.cpp
modules/core/src/opencl/convert.cl
modules/cudaimgproc/src/cuda/canny.cu
modules/cudastereo/perf/perf_stereo.cpp
modules/gpu/perf/perf_imgproc.cpp
modules/gpu/test/test_denoising.cpp
modules/ocl/src/opencl/imgproc_resize.cl
samples/cpp/Qt_sample/main.cpp
12 files changed:
diff --cc CMakeLists.txt
index 04158f753485dfe000bb54c18629c24f8d99c33f,14033b390fcad335d06a26ffde1fa776ab364147..1e1abd943d928b51a7ca74717a2e3e5255d4c8d8
--- 1/CMakeLists.txt
--- 2/CMakeLists.txt
+++ b/CMakeLists.txt
OCV_OPTION(WITH_IPP "Include Intel IPP support" OFF IF (MSVC OR X86 OR X86_64) )
OCV_OPTION(WITH_JASPER "Include JPEG2K support" ON IF (NOT IOS) )
OCV_OPTION(WITH_JPEG "Include JPEG support" ON)
+OCV_OPTION(WITH_WEBP "Include WebP support" ON IF (NOT IOS) )
OCV_OPTION(WITH_OPENEXR "Include ILM support via OpenEXR" ON IF (NOT IOS) )
- OCV_OPTION(WITH_OPENGL "Include OpenGL support" OFF IF (NOT ANDROID AND NOT APPLE) )
+ OCV_OPTION(WITH_OPENGL "Include OpenGL support" OFF IF (NOT ANDROID) )
OCV_OPTION(WITH_OPENNI "Include OpenNI support" OFF IF (NOT ANDROID AND NOT IOS) )
OCV_OPTION(WITH_PNG "Include PNG support" ON)
OCV_OPTION(WITH_PVAPI "Include Prosilica GigE support" ON IF (NOT ANDROID AND NOT IOS) )
diff --cc cmake/OpenCVModule.cmake
Simple merge
diff --cc cmake/templates/cvconfig.h.in
Simple merge
diff --cc modules/contrib/src/rgbdodometry.cpp
Simple merge
Simple merge
diff --cc modules/core/src/gl_core_3_1.cpp
Simple merge
diff --cc modules/cudaimgproc/perf/perf_color.cpp
index 2ff0f1ff60d7ba483156c17a8fb9cdf6105c035b,0000000000000000000000000000000000000000..099e0f9ebe470ed9f5f33ade41f21966838ae49e
mode 100644,000000..100644
mode 100644,000000..100644
--- /dev/null
- CUDA_SANITY_CHECK(dst, 1e-3, ERROR_RELATIVE);
+/*M///////////////////////////////////////////////////////////////////////////////////////
+//
+// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
+//
+// By downloading, copying, installing or using the software you agree to this license.
+// If you do not agree to this license, do not download, install,
+// copy or use the software.
+//
+//
+// License Agreement
+// For Open Source Computer Vision Library
+//
+// Copyright (C) 2000-2008, Intel Corporation, all rights reserved.
+// Copyright (C) 2009, Willow Garage Inc., all rights reserved.
+// Third party copyrights are property of their respective owners.
+//
+// Redistribution and use in source and binary forms, with or without modification,
+// are permitted provided that the following conditions are met:
+//
+// * Redistribution's of source code must retain the above copyright notice,
+// this list of conditions and the following disclaimer.
+//
+// * Redistribution's in binary form must reproduce the above copyright notice,
+// this list of conditions and the following disclaimer in the documentation
+// and/or other materials provided with the distribution.
+//
+// * The name of the copyright holders may not be used to endorse or promote products
+// derived from this software without specific prior written permission.
+//
+// This software is provided by the copyright holders and contributors "as is" and
+// any express or implied warranties, including, but not limited to, the implied
+// warranties of merchantability and fitness for a particular purpose are disclaimed.
+// In no event shall the Intel Corporation or contributors be liable for any direct,
+// indirect, incidental, special, exemplary, or consequential damages
+// (including, but not limited to, procurement of substitute goods or services;
+// loss of use, data, or profits; or business interruption) however caused
+// and on any theory of liability, whether in contract, strict liability,
+// or tort (including negligence or otherwise) arising in any way out of
+// the use of this software, even if advised of the possibility of such damage.
+//
+//M*/
+
+#include "perf_precomp.hpp"
+
+using namespace std;
+using namespace testing;
+using namespace perf;
+
+//////////////////////////////////////////////////////////////////////
+// CvtColor
+
+DEF_PARAM_TEST(Sz_Depth_Code, cv::Size, MatDepth, CvtColorInfo);
+
+PERF_TEST_P(Sz_Depth_Code, CvtColor,
+ Combine(CUDA_TYPICAL_MAT_SIZES,
+ Values(CV_8U, CV_32F),
+ Values(CvtColorInfo(4, 4, cv::COLOR_RGBA2BGRA),
+ CvtColorInfo(4, 1, cv::COLOR_BGRA2GRAY),
+ CvtColorInfo(1, 4, cv::COLOR_GRAY2BGRA),
+ CvtColorInfo(3, 3, cv::COLOR_BGR2XYZ),
+ CvtColorInfo(3, 3, cv::COLOR_XYZ2BGR),
+ CvtColorInfo(3, 3, cv::COLOR_BGR2YCrCb),
+ CvtColorInfo(3, 3, cv::COLOR_YCrCb2BGR),
+ CvtColorInfo(3, 3, cv::COLOR_BGR2YUV),
+ CvtColorInfo(3, 3, cv::COLOR_YUV2BGR),
+ CvtColorInfo(3, 3, cv::COLOR_BGR2HSV),
+ CvtColorInfo(3, 3, cv::COLOR_HSV2BGR),
+ CvtColorInfo(3, 3, cv::COLOR_BGR2HLS),
+ CvtColorInfo(3, 3, cv::COLOR_HLS2BGR),
+ CvtColorInfo(3, 3, cv::COLOR_BGR2Lab),
+ CvtColorInfo(3, 3, cv::COLOR_LBGR2Lab),
+ CvtColorInfo(3, 3, cv::COLOR_BGR2Luv),
+ CvtColorInfo(3, 3, cv::COLOR_LBGR2Luv),
+ CvtColorInfo(3, 3, cv::COLOR_Lab2BGR),
+ CvtColorInfo(3, 3, cv::COLOR_Lab2LBGR),
+ CvtColorInfo(3, 3, cv::COLOR_Luv2RGB),
+ CvtColorInfo(3, 3, cv::COLOR_Luv2LRGB))))
+{
+ const cv::Size size = GET_PARAM(0);
+ const int depth = GET_PARAM(1);
+ const CvtColorInfo info = GET_PARAM(2);
+
+ cv::Mat src(size, CV_MAKETYPE(depth, info.scn));
+ cv::randu(src, 0, depth == CV_8U ? 255.0 : 1.0);
+
+ if (PERF_RUN_CUDA())
+ {
+ const cv::cuda::GpuMat d_src(src);
+ cv::cuda::GpuMat dst;
+
+ TEST_CYCLE() cv::cuda::cvtColor(d_src, dst, info.code, info.dcn);
+
+ CUDA_SANITY_CHECK(dst, 1e-4);
+ }
+ else
+ {
+ cv::Mat dst;
+
+ TEST_CYCLE() cv::cvtColor(src, dst, info.code, info.dcn);
+
+ CPU_SANITY_CHECK(dst);
+ }
+}
+
+PERF_TEST_P(Sz_Depth_Code, CvtColorBayer,
+ Combine(CUDA_TYPICAL_MAT_SIZES,
+ Values(CV_8U, CV_16U),
+ Values(CvtColorInfo(1, 3, cv::COLOR_BayerBG2BGR),
+ CvtColorInfo(1, 3, cv::COLOR_BayerGB2BGR),
+ CvtColorInfo(1, 3, cv::COLOR_BayerRG2BGR),
+ CvtColorInfo(1, 3, cv::COLOR_BayerGR2BGR),
+
+ CvtColorInfo(1, 1, cv::COLOR_BayerBG2GRAY),
+ CvtColorInfo(1, 1, cv::COLOR_BayerGB2GRAY),
+ CvtColorInfo(1, 1, cv::COLOR_BayerRG2GRAY),
+ CvtColorInfo(1, 1, cv::COLOR_BayerGR2GRAY))))
+{
+ const cv::Size size = GET_PARAM(0);
+ const int depth = GET_PARAM(1);
+ const CvtColorInfo info = GET_PARAM(2);
+
+ cv::Mat src(size, CV_MAKETYPE(depth, info.scn));
+ declare.in(src, WARMUP_RNG);
+
+ if (PERF_RUN_CUDA())
+ {
+ const cv::cuda::GpuMat d_src(src);
+ cv::cuda::GpuMat dst;
+
+ TEST_CYCLE() cv::cuda::cvtColor(d_src, dst, info.code, info.dcn);
+
+ CUDA_SANITY_CHECK(dst);
+ }
+ else
+ {
+ cv::Mat dst;
+
+ TEST_CYCLE() cv::cvtColor(src, dst, info.code, info.dcn);
+
+ CPU_SANITY_CHECK(dst);
+ }
+}
+
+//////////////////////////////////////////////////////////////////////
+// Demosaicing
+
+CV_ENUM(DemosaicingCode,
+ cv::COLOR_BayerBG2BGR, cv::COLOR_BayerGB2BGR, cv::COLOR_BayerRG2BGR, cv::COLOR_BayerGR2BGR,
+ cv::COLOR_BayerBG2GRAY, cv::COLOR_BayerGB2GRAY, cv::COLOR_BayerRG2GRAY, cv::COLOR_BayerGR2GRAY,
+ cv::cuda::COLOR_BayerBG2BGR_MHT, cv::cuda::COLOR_BayerGB2BGR_MHT, cv::cuda::COLOR_BayerRG2BGR_MHT, cv::cuda::COLOR_BayerGR2BGR_MHT,
+ cv::cuda::COLOR_BayerBG2GRAY_MHT, cv::cuda::COLOR_BayerGB2GRAY_MHT, cv::cuda::COLOR_BayerRG2GRAY_MHT, cv::cuda::COLOR_BayerGR2GRAY_MHT)
+
+DEF_PARAM_TEST(Sz_Code, cv::Size, DemosaicingCode);
+
+PERF_TEST_P(Sz_Code, Demosaicing,
+ Combine(CUDA_TYPICAL_MAT_SIZES,
+ DemosaicingCode::all()))
+{
+ const cv::Size size = GET_PARAM(0);
+ const int code = GET_PARAM(1);
+
+ cv::Mat src(size, CV_8UC1);
+ declare.in(src, WARMUP_RNG);
+
+ if (PERF_RUN_CUDA())
+ {
+ const cv::cuda::GpuMat d_src(src);
+ cv::cuda::GpuMat dst;
+
+ TEST_CYCLE() cv::cuda::demosaicing(d_src, dst, code);
+
+ CUDA_SANITY_CHECK(dst);
+ }
+ else
+ {
+ if (code >= cv::COLOR_COLORCVT_MAX)
+ {
+ FAIL_NO_CPU();
+ }
+ else
+ {
+ cv::Mat dst;
+
+ TEST_CYCLE() cv::cvtColor(src, dst, code);
+
+ CPU_SANITY_CHECK(dst);
+ }
+ }
+}
+
+//////////////////////////////////////////////////////////////////////
+// SwapChannels
+
+PERF_TEST_P(Sz, SwapChannels,
+ CUDA_TYPICAL_MAT_SIZES)
+{
+ const cv::Size size = GetParam();
+
+ cv::Mat src(size, CV_8UC4);
+ declare.in(src, WARMUP_RNG);
+
+ const int dstOrder[] = {2, 1, 0, 3};
+
+ if (PERF_RUN_CUDA())
+ {
+ cv::cuda::GpuMat dst(src);
+
+ TEST_CYCLE() cv::cuda::swapChannels(dst, dstOrder);
+
+ CUDA_SANITY_CHECK(dst);
+ }
+ else
+ {
+ FAIL_NO_CPU();
+ }
+}
+
+//////////////////////////////////////////////////////////////////////
+// AlphaComp
+
+CV_ENUM(AlphaOp, cv::cuda::ALPHA_OVER, cv::cuda::ALPHA_IN, cv::cuda::ALPHA_OUT, cv::cuda::ALPHA_ATOP, cv::cuda::ALPHA_XOR, cv::cuda::ALPHA_PLUS, cv::cuda::ALPHA_OVER_PREMUL, cv::cuda::ALPHA_IN_PREMUL, cv::cuda::ALPHA_OUT_PREMUL, cv::cuda::ALPHA_ATOP_PREMUL, cv::cuda::ALPHA_XOR_PREMUL, cv::cuda::ALPHA_PLUS_PREMUL, cv::cuda::ALPHA_PREMUL)
+
+DEF_PARAM_TEST(Sz_Type_Op, cv::Size, MatType, AlphaOp);
+
+PERF_TEST_P(Sz_Type_Op, AlphaComp,
+ Combine(CUDA_TYPICAL_MAT_SIZES,
+ Values(CV_8UC4, CV_16UC4, CV_32SC4, CV_32FC4),
+ AlphaOp::all()))
+{
+ const cv::Size size = GET_PARAM(0);
+ const int type = GET_PARAM(1);
+ const int alpha_op = GET_PARAM(2);
+
+ cv::Mat img1(size, type);
+ cv::Mat img2(size, type);
+ declare.in(img1, img2, WARMUP_RNG);
+
+ if (PERF_RUN_CUDA())
+ {
+ const cv::cuda::GpuMat d_img1(img1);
+ const cv::cuda::GpuMat d_img2(img2);
+ cv::cuda::GpuMat dst;
+
+ TEST_CYCLE() cv::cuda::alphaComp(d_img1, d_img2, dst, alpha_op);
+
++ if (CV_MAT_DEPTH(type) < CV_32F)
++ {
++ CUDA_SANITY_CHECK(dst, 1);
++ }
++ else
++ {
++ CUDA_SANITY_CHECK(dst, 1e-3, ERROR_RELATIVE);
++ }
+ }
+ else
+ {
+ FAIL_NO_CPU();
+ }
+}
diff --cc modules/cudaimgproc/src/cuda/canny.cu
index 043d6e5ff76409a3036a3c3aad2d66eb69f24e98,1dc179e34089765f83c0bfa832b8eb88655467bf..36cccb0e33aea0910e02cff0d1f2026066a85089
#if !defined CUDA_DISABLER
- #include <utility>
- #include <algorithm>
-#include "opencv2/gpu/device/common.hpp"
-#include "opencv2/gpu/device/emulation.hpp"
-#include "opencv2/gpu/device/transform.hpp"
-#include "opencv2/gpu/device/functional.hpp"
-#include "opencv2/gpu/device/utility.hpp"
+#include "opencv2/core/cuda/common.hpp"
+#include "opencv2/core/cuda/emulation.hpp"
+#include "opencv2/core/cuda/transform.hpp"
+#include "opencv2/core/cuda/functional.hpp"
+#include "opencv2/core/cuda/utility.hpp"
-using namespace cv::gpu;
-using namespace cv::gpu::device;
+using namespace cv::cuda;
+using namespace cv::cuda::device;
namespace canny
{
index e80116a75f291fa38c8d2042ca88224157342ede,571403d2a735ef1d8b3c1b1a2cb8aedc23cc9702..110fed0339c058dd5c834525683ae79f836e4553
cv::Mat frame1 = readImage("opticalflow/rubberwhale2.png", cv::IMREAD_GRAYSCALE);
ASSERT_FALSE(frame1.empty());
+ cv::resize(frame1, frame1, cv::Size(), 0.5, 0.5);
- cv::Size block_size(16, 16);
+ cv::Size block_size(8, 8);
cv::Size shift_size(1, 1);
- cv::Size max_range(16, 16);
+ cv::Size max_range(8, 8);
- cv::gpu::GpuMat d_velx, d_vely, buf;
- cv::gpu::calcOpticalFlowBM(loadMat(frame0), loadMat(frame1),
+ cv::cuda::GpuMat d_velx, d_vely, buf;
+ cv::cuda::calcOpticalFlowBM(loadMat(frame0), loadMat(frame1),
block_size, shift_size, max_range, false,
d_velx, d_vely, buf);
diff --cc modules/highgui/src/grfmt_tiff.cpp
Simple merge
diff --cc modules/highgui/test/test_grfmt.cpp
index d670fa3da6b2fa06fbdf20f44a1a4594b9a28de5,edccc0280a76afdb8513f7abfdd883911ef8063a..0343ba154e09af548b5600d3318ea9abd2d976d4
try
{
- cv::imread(file3);
- EXPECT_NO_THROW(cv::imread(file4));
- cv::imread(file3, CV_LOAD_IMAGE_UNCHANGED);
- EXPECT_NO_THROW(cv::imread(file4, CV_LOAD_IMAGE_UNCHANGED));
++ cv::imread(file3, IMREAD_UNCHANGED);
++ EXPECT_NO_THROW(cv::imread(file4, IMREAD_UNCHANGED));
}
catch(const std::bad_alloc&)
{
remove(file3.c_str());
remove(file4.c_str());
}
- Mat img = imread(filename, CV_LOAD_IMAGE_UNCHANGED);
+
+ TEST(Highgui_Tiff, write_read_16bit_big_little_endian)
+ {
+ // see issue #2601 "16-bit Grayscale TIFF Load Failures Due to Buffer Underflow and Endianness"
+
+ // Setup data for two minimal 16-bit grayscale TIFF files in both endian formats
+ uchar tiff_sample_data[2][86] = { {
+ // Little endian
+ 0x49, 0x49, 0x2a, 0x00, 0x0c, 0x00, 0x00, 0x00, 0xad, 0xde, 0xef, 0xbe, 0x06, 0x00, 0x00, 0x01,
+ 0x03, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x01, 0x03, 0x00, 0x01, 0x00,
+ 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x01, 0x03, 0x00, 0x01, 0x00, 0x00, 0x00, 0x10, 0x00,
+ 0x00, 0x00, 0x06, 0x01, 0x03, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x11, 0x01,
+ 0x04, 0x00, 0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x17, 0x01, 0x04, 0x00, 0x01, 0x00,
+ 0x00, 0x00, 0x04, 0x00, 0x00, 0x00 }, {
+ // Big endian
+ 0x4d, 0x4d, 0x00, 0x2a, 0x00, 0x00, 0x00, 0x0c, 0xde, 0xad, 0xbe, 0xef, 0x00, 0x06, 0x01, 0x00,
+ 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, 0x00, 0x01, 0x01, 0x00, 0x03, 0x00, 0x00,
+ 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x01, 0x02, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x10,
+ 0x00, 0x00, 0x01, 0x06, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x01, 0x11,
+ 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x08, 0x01, 0x17, 0x00, 0x04, 0x00, 0x00,
+ 0x00, 0x01, 0x00, 0x00, 0x00, 0x04 }
+ };
+
+ // Test imread() for both a little endian TIFF and big endian TIFF
+ for (int i = 0; i < 2; i++)
+ {
+ string filename = cv::tempfile(".tiff");
+
+ // Write sample TIFF file
+ FILE* fp = fopen(filename.c_str(), "wb");
+ ASSERT_TRUE(fp != NULL);
+ ASSERT_EQ((size_t)1, fwrite(tiff_sample_data, 86, 1, fp));
+ fclose(fp);
+
++ Mat img = imread(filename, IMREAD_UNCHANGED);
+
+ EXPECT_EQ(1, img.rows);
+ EXPECT_EQ(2, img.cols);
+ EXPECT_EQ(CV_16U, img.type());
+ EXPECT_EQ(sizeof(ushort), img.elemSize());
+ EXPECT_EQ(1, img.channels());
+ EXPECT_EQ(0xDEAD, img.at<ushort>(0,0));
+ EXPECT_EQ(0xBEEF, img.at<ushort>(0,1));
+
+ remove(filename.c_str());
+ }
+ }
+
#endif
+
+#ifdef HAVE_WEBP
+
+TEST(Highgui_WebP, encode_decode_lossless_webp)
+{
+ cvtest::TS& ts = *cvtest::TS::ptr();
+ string input = string(ts.get_data_path()) + "../cv/shared/lena.png";
+ cv::Mat img = cv::imread(input);
+ ASSERT_FALSE(img.empty());
+
+ string output = cv::tempfile(".webp");
+ EXPECT_NO_THROW(cv::imwrite(output, img)); // lossless
+
+ cv::Mat img_webp = cv::imread(output);
+
+ std::vector<unsigned char> buf;
+
+ FILE * wfile = NULL;
+
+ wfile = fopen(output.c_str(), "rb");
+ if (wfile != NULL)
+ {
+ fseek(wfile, 0, SEEK_END);
+ size_t wfile_size = ftell(wfile);
+ fseek(wfile, 0, SEEK_SET);
+
+ buf.resize(wfile_size);
+
+ size_t data_size = fread(&buf[0], 1, wfile_size, wfile);
+
+ if(wfile)
+ {
+ fclose(wfile);
+ }
+
+ if (data_size != wfile_size)
+ {
+ EXPECT_TRUE(false);
+ }
+ }
+
+ remove(output.c_str());
+
+ cv::Mat decode = cv::imdecode(buf, IMREAD_COLOR);
+ ASSERT_FALSE(decode.empty());
+ EXPECT_TRUE(cv::norm(decode, img_webp, NORM_INF) == 0);
+
+ ASSERT_FALSE(img_webp.empty());
+
+ EXPECT_TRUE(cv::norm(img, img_webp, NORM_INF) == 0);
+}
+
+TEST(Highgui_WebP, encode_decode_lossy_webp)
+{
+ cvtest::TS& ts = *cvtest::TS::ptr();
+ std::string input = std::string(ts.get_data_path()) + "../cv/shared/lena.png";
+ cv::Mat img = cv::imread(input);
+ ASSERT_FALSE(img.empty());
+
+ for(int q = 100; q>=0; q-=20)
+ {
+ std::vector<int> params;
+ params.push_back(IMWRITE_WEBP_QUALITY);
+ params.push_back(q);
+ string output = cv::tempfile(".webp");
+
+ EXPECT_NO_THROW(cv::imwrite(output, img, params));
+ cv::Mat img_webp = cv::imread(output);
+ remove(output.c_str());
+ EXPECT_FALSE(img_webp.empty());
+ EXPECT_EQ(3, img_webp.channels());
+ EXPECT_EQ(512, img_webp.cols);
+ EXPECT_EQ(512, img_webp.rows);
+ }
+}
+
+TEST(Highgui_WebP, encode_decode_with_alpha_webp)
+{
+ cvtest::TS& ts = *cvtest::TS::ptr();
+ std::string input = std::string(ts.get_data_path()) + "../cv/shared/lena.png";
+ cv::Mat img = cv::imread(input);
+ ASSERT_FALSE(img.empty());
+
+ std::vector<cv::Mat> imgs;
+ cv::split(img, imgs);
+ imgs.push_back(cv::Mat(imgs[0]));
+ imgs[imgs.size() - 1] = cv::Scalar::all(128);
+ cv::merge(imgs, img);
+
+ string output = cv::tempfile(".webp");
+
+ EXPECT_NO_THROW(cv::imwrite(output, img));
+ cv::Mat img_webp = cv::imread(output);
+ remove(output.c_str());
+ EXPECT_FALSE(img_webp.empty());
+ EXPECT_EQ(4, img_webp.channels());
+ EXPECT_EQ(512, img_webp.cols);
+ EXPECT_EQ(512, img_webp.rows);
+}
+
+#endif
+
+TEST(Highgui_Hdr, regression)
+{
+ string folder = string(cvtest::TS::ptr()->get_data_path()) + "/readwrite/";
+ string name_rle = folder + "rle.hdr";
+ string name_no_rle = folder + "no_rle.hdr";
+ Mat img_rle = imread(name_rle, -1);
+ ASSERT_FALSE(img_rle.empty()) << "Could not open " << name_rle;
+ Mat img_no_rle = imread(name_no_rle, -1);
+ ASSERT_FALSE(img_no_rle.empty()) << "Could not open " << name_no_rle;
+
+ double min = 0.0, max = 1.0;
+ minMaxLoc(abs(img_rle - img_no_rle), &min, &max);
+ ASSERT_FALSE(max > DBL_EPSILON);
+ string tmp_file_name = tempfile(".hdr");
+ vector<int>param(1);
+ for(int i = 0; i < 2; i++) {
+ param[0] = i;
+ imwrite(tmp_file_name, img_rle, param);
+ Mat written_img = imread(tmp_file_name, -1);
+ ASSERT_FALSE(written_img.empty()) << "Could not open " << tmp_file_name;
+ minMaxLoc(abs(img_rle - written_img), &min, &max);
+ ASSERT_FALSE(max > DBL_EPSILON);
+ }
+}
index 2051368a046dd1d67d51883da304ad220a1dcefa,e416e92597948923bcbca1907ec84c64fcc68c55..dce20b9f51efb6e19ac77898705f2926fdc41531
////////////////////////////////////////////////////////
// Brute Force Non local means
-struct BruteForceNonLocalMeans: testing::TestWithParam<cv::gpu::DeviceInfo>
-{
- cv::gpu::DeviceInfo devInfo;
-
- virtual void SetUp()
- {
- devInfo = GetParam();
- cv::gpu::setDevice(devInfo.deviceID());
- }
-};
-
-GPU_TEST_P(BruteForceNonLocalMeans, Regression)
+TEST(CUDA_BruteForceNonLocalMeans, Regression)
{
- using cv::gpu::GpuMat;
+ using cv::cuda::GpuMat;
- cv::Mat bgr = readImage("denoising/lena_noised_gaussian_sigma=20_multi_0.png", cv::IMREAD_COLOR);
+ cv::Mat bgr = readImage("../gpu/denoising/lena_noised_gaussian_sigma=20_multi_0.png", cv::IMREAD_COLOR);
ASSERT_FALSE(bgr.empty());
+ cv::resize(bgr, bgr, cv::Size(256, 256));
cv::Mat gray;
- cv::cvtColor(bgr, gray, CV_BGR2GRAY);
+ cv::cvtColor(bgr, gray, cv::COLOR_BGR2GRAY);
GpuMat dbgr, dgray;
- cv::gpu::nonLocalMeans(GpuMat(bgr), dbgr, 20);
- cv::gpu::nonLocalMeans(GpuMat(gray), dgray, 20);
+ cv::cuda::nonLocalMeans(GpuMat(bgr), dbgr, 20);
+ cv::cuda::nonLocalMeans(GpuMat(gray), dgray, 20);
#if 0
- dumpImage("denoising/nlm_denoised_lena_bgr.png", cv::Mat(dbgr));
- dumpImage("denoising/nlm_denoised_lena_gray.png", cv::Mat(dgray));
+ dumpImage("../gpu/denoising/nlm_denoised_lena_bgr.png", cv::Mat(dbgr));
+ dumpImage("../gpu/denoising/nlm_denoised_lena_gray.png", cv::Mat(dgray));
#endif
- cv::Mat bgr_gold = readImage("denoising/nlm_denoised_lena_bgr.png", cv::IMREAD_COLOR);
- cv::Mat gray_gold = readImage("denoising/nlm_denoised_lena_gray.png", cv::IMREAD_GRAYSCALE);
+ cv::Mat bgr_gold = readImage("../gpu/denoising/nlm_denoised_lena_bgr.png", cv::IMREAD_COLOR);
+ cv::Mat gray_gold = readImage("../gpu/denoising/nlm_denoised_lena_gray.png", cv::IMREAD_GRAYSCALE);
ASSERT_FALSE(bgr_gold.empty() || gray_gold.empty());
+ cv::resize(bgr_gold, bgr_gold, cv::Size(256, 256));
+ cv::resize(gray_gold, gray_gold, cv::Size(256, 256));
EXPECT_MAT_NEAR(bgr_gold, dbgr, 1e-4);
EXPECT_MAT_NEAR(gray_gold, dgray, 1e-4);