fixed extrapolation for ocl::cornerMinEigenVal and ocl::cornerHarris; enabled CV_32FC1 for the first function

This commit is contained in:
Ilya Lavrenov
2013-10-29 12:10:20 +04:00
parent c5e8a9a29b
commit bf6b5ee925
5 changed files with 186 additions and 164 deletions

View File

@@ -80,7 +80,7 @@ PARAM_TEST_CASE(ImgprocTestBase, MatType,
useRoi = GET_PARAM(3);
}
void random_roi()
virtual void random_roi()
{
Size roiSize = randomSize(1, MAX_VALUE);
Border srcBorder = randomBorder(0, useRoi ? MAX_VALUE : 0);
@@ -191,7 +191,31 @@ OCL_TEST_P(EqualizeHist, Mat)
////////////////////////////////cornerMinEigenVal//////////////////////////////////////////
typedef ImgprocTestBase CornerMinEigenVal;
struct CornerTestBase :
public ImgprocTestBase
{
virtual void random_roi()
{
Mat image = readImageType("gpu/stereobm/aloe-L.png", type);
ASSERT_FALSE(image.empty());
Size roiSize = image.size();
Border srcBorder = randomBorder(0, useRoi ? MAX_VALUE : 0);
Size wholeSize = Size(roiSize.width + srcBorder.lef + srcBorder.rig, roiSize.height + srcBorder.top + srcBorder.bot);
src = randomMat(wholeSize, type, -255, 255, false);
src_roi = src(Rect(srcBorder.lef, srcBorder.top, roiSize.width, roiSize.height));
image.copyTo(src_roi);
Border dstBorder = randomBorder(0, useRoi ? MAX_VALUE : 0);
randomSubMat(dst_whole, dst_roi, roiSize, dstBorder, CV_32FC1, 5, 16);
generateOclMat(gsrc_whole, gsrc_roi, src, roiSize, srcBorder);
generateOclMat(gdst_whole, gdst_roi, dst_whole, roiSize, dstBorder);
}
};
typedef CornerTestBase CornerMinEigenVal;
OCL_TEST_P(CornerMinEigenVal, Mat)
{
@@ -204,13 +228,13 @@ OCL_TEST_P(CornerMinEigenVal, Mat)
cornerMinEigenVal(src_roi, dst_roi, blockSize, apertureSize, borderType);
ocl::cornerMinEigenVal(gsrc_roi, gdst_roi, blockSize, apertureSize, borderType);
Near(1.0);
Near(0.02);
}
}
////////////////////////////////cornerHarris//////////////////////////////////////////
typedef ImgprocTestBase CornerHarris;
typedef CornerTestBase CornerHarris;
OCL_TEST_P(CornerHarris, Mat)
{
@@ -219,12 +243,12 @@ OCL_TEST_P(CornerHarris, Mat)
random_roi();
int apertureSize = 3;
double k = 2.0;
double k = randomDouble(0.01, 0.9);
cornerHarris(src_roi, dst_roi, blockSize, apertureSize, k, borderType);
ocl::cornerHarris(gsrc_roi, gdst_roi, blockSize, apertureSize, k, borderType);
Near(1.0);
Near(0.02);
}
}
@@ -484,19 +508,19 @@ INSTANTIATE_TEST_CASE_P(Imgproc, EqualizeHist, Combine(
Bool()));
INSTANTIATE_TEST_CASE_P(Imgproc, CornerMinEigenVal, Combine(
Values(CV_8UC1, CV_32FC1),
Values(3), // TODO some fails when blockSize != 3 (for example 5)
Values((int)BORDER_REFLECT, (int)BORDER_CONSTANT, (int)BORDER_REPLICATE), // TODO does not work with (int)BORDER_REFLECT101
Values((MatType)CV_8UC1, (MatType)CV_32FC1),
Values(3, 5),
Values((int)BORDER_CONSTANT, (int)BORDER_REPLICATE, (int)BORDER_REFLECT, (int)BORDER_REFLECT101),
Bool()));
INSTANTIATE_TEST_CASE_P(Imgproc, CornerHarris, Combine(
Values((MatType)CV_8UC1), // TODO does not work properly with CV_32FC1
Values(3, 5),
Values((int)BORDER_REFLECT101, (int)BORDER_REFLECT, (int)BORDER_CONSTANT, (int)BORDER_REPLICATE),
Values( (int)BORDER_CONSTANT, (int)BORDER_REPLICATE, (int)BORDER_REFLECT, (int)BORDER_REFLECT_101),
Bool()));
INSTANTIATE_TEST_CASE_P(Imgproc, Integral, Combine(
Values((MatType)CV_8UC1), // TODO does work with CV_32F, CV_64F
Values((MatType)CV_8UC1), // TODO does not work with CV_32F, CV_64F
Values(0), // not used
Values(0), // not used
Bool()));