mirror of https://github.com/opencv/opencv.git
Open Source Computer Vision Library
https://opencv.org/
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
150 lines
5.3 KiB
150 lines
5.3 KiB
13 years ago
|
/*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.
|
||
|
//
|
||
|
//
|
||
12 years ago
|
// License Agreement
|
||
13 years ago
|
// For Open Source Computer Vision Library
|
||
|
//
|
||
12 years ago
|
// Copyright (C) 2000-2008, Intel Corporation, all rights reserved.
|
||
|
// Copyright (C) 2009, Willow Garage Inc., all rights reserved.
|
||
13 years ago
|
// 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.
|
||
|
//
|
||
12 years ago
|
// * The name of the copyright holders may not be used to endorse or promote products
|
||
13 years ago
|
// 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*/
|
||
|
|
||
12 years ago
|
#include "test_precomp.hpp"
|
||
13 years ago
|
|
||
|
#ifdef HAVE_CUDA
|
||
|
|
||
12 years ago
|
using namespace cvtest;
|
||
|
|
||
12 years ago
|
///////////////////////////////////////////////////////////////////////////////////////////////////////
|
||
|
// CornerHarris
|
||
13 years ago
|
|
||
12 years ago
|
namespace
|
||
|
{
|
||
|
IMPLEMENT_PARAM_CLASS(BlockSize, int);
|
||
|
IMPLEMENT_PARAM_CLASS(ApertureSize, int);
|
||
|
}
|
||
|
|
||
11 years ago
|
PARAM_TEST_CASE(CornerHarris, cv::cuda::DeviceInfo, MatType, BorderType, BlockSize, ApertureSize)
|
||
13 years ago
|
{
|
||
11 years ago
|
cv::cuda::DeviceInfo devInfo;
|
||
13 years ago
|
int type;
|
||
12 years ago
|
int borderType;
|
||
|
int blockSize;
|
||
|
int apertureSize;
|
||
13 years ago
|
|
||
|
virtual void SetUp()
|
||
|
{
|
||
|
devInfo = GET_PARAM(0);
|
||
12 years ago
|
type = GET_PARAM(1);
|
||
|
borderType = GET_PARAM(2);
|
||
|
blockSize = GET_PARAM(3);
|
||
|
apertureSize = GET_PARAM(4);
|
||
13 years ago
|
|
||
11 years ago
|
cv::cuda::setDevice(devInfo.deviceID());
|
||
13 years ago
|
}
|
||
|
};
|
||
|
|
||
12 years ago
|
GPU_TEST_P(CornerHarris, Accuracy)
|
||
13 years ago
|
{
|
||
12 years ago
|
cv::Mat src = readImageType("stereobm/aloe-L.png", type);
|
||
|
ASSERT_FALSE(src.empty());
|
||
|
|
||
|
double k = randomDouble(0.1, 0.9);
|
||
13 years ago
|
|
||
11 years ago
|
cv::Ptr<cv::cuda::CornernessCriteria> harris = cv::cuda::createHarrisCorner(src.type(), blockSize, apertureSize, k, borderType);
|
||
12 years ago
|
|
||
11 years ago
|
cv::cuda::GpuMat dst;
|
||
12 years ago
|
harris->compute(loadMat(src), dst);
|
||
13 years ago
|
|
||
|
cv::Mat dst_gold;
|
||
12 years ago
|
cv::cornerHarris(src, dst_gold, blockSize, apertureSize, k, borderType);
|
||
13 years ago
|
|
||
12 years ago
|
EXPECT_MAT_NEAR(dst_gold, dst, 0.02);
|
||
13 years ago
|
}
|
||
|
|
||
12 years ago
|
INSTANTIATE_TEST_CASE_P(GPU_ImgProc, CornerHarris, testing::Combine(
|
||
13 years ago
|
ALL_DEVICES,
|
||
12 years ago
|
testing::Values(MatType(CV_8UC1), MatType(CV_32FC1)),
|
||
|
testing::Values(BorderType(cv::BORDER_REFLECT101), BorderType(cv::BORDER_REPLICATE), BorderType(cv::BORDER_REFLECT)),
|
||
|
testing::Values(BlockSize(3), BlockSize(5), BlockSize(7)),
|
||
|
testing::Values(ApertureSize(0), ApertureSize(3), ApertureSize(5), ApertureSize(7))));
|
||
13 years ago
|
|
||
12 years ago
|
///////////////////////////////////////////////////////////////////////////////////////////////////////
|
||
|
// cornerMinEigen
|
||
13 years ago
|
|
||
11 years ago
|
PARAM_TEST_CASE(CornerMinEigen, cv::cuda::DeviceInfo, MatType, BorderType, BlockSize, ApertureSize)
|
||
13 years ago
|
{
|
||
11 years ago
|
cv::cuda::DeviceInfo devInfo;
|
||
13 years ago
|
int type;
|
||
12 years ago
|
int borderType;
|
||
|
int blockSize;
|
||
|
int apertureSize;
|
||
13 years ago
|
|
||
|
virtual void SetUp()
|
||
|
{
|
||
|
devInfo = GET_PARAM(0);
|
||
12 years ago
|
type = GET_PARAM(1);
|
||
|
borderType = GET_PARAM(2);
|
||
|
blockSize = GET_PARAM(3);
|
||
|
apertureSize = GET_PARAM(4);
|
||
13 years ago
|
|
||
11 years ago
|
cv::cuda::setDevice(devInfo.deviceID());
|
||
13 years ago
|
}
|
||
|
};
|
||
|
|
||
12 years ago
|
GPU_TEST_P(CornerMinEigen, Accuracy)
|
||
13 years ago
|
{
|
||
12 years ago
|
cv::Mat src = readImageType("stereobm/aloe-L.png", type);
|
||
|
ASSERT_FALSE(src.empty());
|
||
13 years ago
|
|
||
11 years ago
|
cv::Ptr<cv::cuda::CornernessCriteria> minEigenVal = cv::cuda::createMinEigenValCorner(src.type(), blockSize, apertureSize, borderType);
|
||
12 years ago
|
|
||
11 years ago
|
cv::cuda::GpuMat dst;
|
||
12 years ago
|
minEigenVal->compute(loadMat(src), dst);
|
||
13 years ago
|
|
||
|
cv::Mat dst_gold;
|
||
12 years ago
|
cv::cornerMinEigenVal(src, dst_gold, blockSize, apertureSize, borderType);
|
||
13 years ago
|
|
||
12 years ago
|
EXPECT_MAT_NEAR(dst_gold, dst, 0.02);
|
||
13 years ago
|
}
|
||
|
|
||
12 years ago
|
INSTANTIATE_TEST_CASE_P(GPU_ImgProc, CornerMinEigen, testing::Combine(
|
||
13 years ago
|
ALL_DEVICES,
|
||
12 years ago
|
testing::Values(MatType(CV_8UC1), MatType(CV_32FC1)),
|
||
|
testing::Values(BorderType(cv::BORDER_REFLECT101), BorderType(cv::BORDER_REPLICATE), BorderType(cv::BORDER_REFLECT)),
|
||
|
testing::Values(BlockSize(3), BlockSize(5), BlockSize(7)),
|
||
|
testing::Values(ApertureSize(0), ApertureSize(3), ApertureSize(5), ApertureSize(7))));
|
||
13 years ago
|
|
||
|
#endif // HAVE_CUDA
|