Remove two "set" kernel call

pull/3210/head
Alexander Karsakov 10 years ago
parent 71edf1b5f1
commit 8c08714b8c
  1. 9
      modules/imgproc/src/featureselect.cpp
  2. 4
      modules/imgproc/src/opencl/gftt.cl

@ -85,6 +85,7 @@ static bool ocl_goodFeaturesToTrack( InputArray _image, OutputArray _corners,
size_t total, i, j, ncorners = 0, possibleCornersCount =
std::max(1024, static_cast<int>(imgsize.area() * 0.1));
bool haveMask = !_mask.empty();
UMat counter(1, 1, CV_32SC1);
// find threshold
{
@ -108,7 +109,8 @@ static bool ocl_goodFeaturesToTrack( InputArray _image, OutputArray _corners,
ocl::KernelArg eigarg = ocl::KernelArg::ReadOnlyNoSize(eig),
dbarg = ocl::KernelArg::PtrWriteOnly(maxEigenValue),
maskarg = ocl::KernelArg::ReadOnlyNoSize(mask);
maskarg = ocl::KernelArg::ReadOnlyNoSize(mask),
counterarg = ocl::KernelArg::PtrReadWrite(counter);
if (haveMask)
k.args(eigarg, eig.cols, (int)eig.total(), dbarg, maskarg);
@ -125,7 +127,7 @@ static bool ocl_goodFeaturesToTrack( InputArray _image, OutputArray _corners,
if (k2.empty())
return false;
k2.args(dbarg, (float)qualityLevel);
k2.args(dbarg, (float)qualityLevel, counterarg);
if (!k2.runTask(false))
return false;
@ -138,8 +140,7 @@ static bool ocl_goodFeaturesToTrack( InputArray _image, OutputArray _corners,
if (k.empty())
return false;
UMat counter(1, 1, CV_32SC1, Scalar::all(0)),
corners(1, (int)possibleCornersCount, CV_32FC2, Scalar::all(-1));
UMat corners(1, (int)possibleCornersCount, CV_32FC2);
CV_Assert(sizeof(Corner) == corners.elemSize());
ocl::KernelArg eigarg = ocl::KernelArg::ReadOnlyNoSize(eig),

@ -91,7 +91,8 @@ __kernel void maxEigenVal(__global const uchar * srcptr, int src_step, int src_o
*(__global float *)(dstptr + (int)sizeof(float) * gid) = localmem_max[0];
}
__kernel void maxEigenValTask(__global float * dst, float qualityLevel)
__kernel void maxEigenValTask(__global float * dst, float qualityLevel,
__global int * counter)
{
float maxval = -FLT_MAX;
@ -100,6 +101,7 @@ __kernel void maxEigenValTask(__global float * dst, float qualityLevel)
maxval = max(maxval, dst[x]);
dst[0] = maxval * qualityLevel;
counter[0] = 0;
}
#elif OP_FIND_CORNERS

Loading…
Cancel
Save