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
{
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);
if (k2.empty())
return false;
- k2.args(dbarg, (float)qualityLevel);
+ k2.args(dbarg, (float)qualityLevel, counterarg);
if (!k2.runTask(false))
return false;
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),
*(__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;
maxval = max(maxval, dst[x]);
dst[0] = maxval * qualityLevel;
+ counter[0] = 0;
}
#elif OP_FIND_CORNERS