|
|
|
@ -55,9 +55,6 @@ void cv::gpu::buildWarpPlaneMaps(Size, Rect, const Mat&, const Mat&, const Mat&, |
|
|
|
|
void cv::gpu::buildWarpCylindricalMaps(Size, Rect, const Mat&, const Mat&, float, GpuMat&, GpuMat&, Stream&) { throw_no_cuda(); } |
|
|
|
|
void cv::gpu::buildWarpSphericalMaps(Size, Rect, const Mat&, const Mat&, float, GpuMat&, GpuMat&, Stream&) { throw_no_cuda(); } |
|
|
|
|
void cv::gpu::rotate(const GpuMat&, GpuMat&, Size, double, double, double, int, Stream&) { throw_no_cuda(); } |
|
|
|
|
void cv::gpu::integral(const GpuMat&, GpuMat&, Stream&) { throw_no_cuda(); } |
|
|
|
|
void cv::gpu::integralBuffered(const GpuMat&, GpuMat&, GpuMat&, Stream&) { throw_no_cuda(); } |
|
|
|
|
void cv::gpu::sqrIntegral(const GpuMat&, GpuMat&, Stream&) { throw_no_cuda(); } |
|
|
|
|
void cv::gpu::evenLevels(GpuMat&, int, int, int) { throw_no_cuda(); } |
|
|
|
|
void cv::gpu::histEven(const GpuMat&, GpuMat&, int, int, int, Stream&) { throw_no_cuda(); } |
|
|
|
|
void cv::gpu::histEven(const GpuMat&, GpuMat&, GpuMat&, int, int, int, Stream&) { throw_no_cuda(); } |
|
|
|
@ -412,111 +409,6 @@ void cv::gpu::rotate(const GpuMat& src, GpuMat& dst, Size dsize, double angle, d |
|
|
|
|
funcs[src.depth()][src.channels() - 1](src, dst, dsize, angle, xShift, yShift, interpolation, StreamAccessor::getStream(stream)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////
|
|
|
|
|
// integral
|
|
|
|
|
|
|
|
|
|
void cv::gpu::integral(const GpuMat& src, GpuMat& sum, Stream& s) |
|
|
|
|
{ |
|
|
|
|
GpuMat buffer; |
|
|
|
|
integralBuffered(src, sum, buffer, s); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
namespace cv { namespace gpu { namespace cudev |
|
|
|
|
{ |
|
|
|
|
namespace imgproc |
|
|
|
|
{ |
|
|
|
|
void shfl_integral_gpu(const PtrStepSzb& img, PtrStepSz<unsigned int> integral, cudaStream_t stream); |
|
|
|
|
} |
|
|
|
|
}}} |
|
|
|
|
|
|
|
|
|
void cv::gpu::integralBuffered(const GpuMat& src, GpuMat& sum, GpuMat& buffer, Stream& s) |
|
|
|
|
{ |
|
|
|
|
CV_Assert(src.type() == CV_8UC1); |
|
|
|
|
|
|
|
|
|
cudaStream_t stream = StreamAccessor::getStream(s); |
|
|
|
|
|
|
|
|
|
cv::Size whole; |
|
|
|
|
cv::Point offset; |
|
|
|
|
|
|
|
|
|
src.locateROI(whole, offset); |
|
|
|
|
|
|
|
|
|
if (deviceSupports(WARP_SHUFFLE_FUNCTIONS) && src.cols <= 2048 |
|
|
|
|
&& offset.x % 16 == 0 && ((src.cols + 63) / 64) * 64 <= (static_cast<int>(src.step) - offset.x)) |
|
|
|
|
{ |
|
|
|
|
ensureSizeIsEnough(((src.rows + 7) / 8) * 8, ((src.cols + 63) / 64) * 64, CV_32SC1, buffer); |
|
|
|
|
|
|
|
|
|
cv::gpu::cudev::imgproc::shfl_integral_gpu(src, buffer, stream); |
|
|
|
|
|
|
|
|
|
sum.create(src.rows + 1, src.cols + 1, CV_32SC1); |
|
|
|
|
if (s) |
|
|
|
|
s.enqueueMemSet(sum, Scalar::all(0)); |
|
|
|
|
else |
|
|
|
|
sum.setTo(Scalar::all(0)); |
|
|
|
|
|
|
|
|
|
GpuMat inner = sum(Rect(1, 1, src.cols, src.rows)); |
|
|
|
|
GpuMat res = buffer(Rect(0, 0, src.cols, src.rows)); |
|
|
|
|
|
|
|
|
|
if (s) |
|
|
|
|
s.enqueueCopy(res, inner); |
|
|
|
|
else |
|
|
|
|
res.copyTo(inner); |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
sum.create(src.rows + 1, src.cols + 1, CV_32SC1); |
|
|
|
|
|
|
|
|
|
NcvSize32u roiSize; |
|
|
|
|
roiSize.width = src.cols; |
|
|
|
|
roiSize.height = src.rows; |
|
|
|
|
|
|
|
|
|
cudaDeviceProp prop; |
|
|
|
|
cudaSafeCall( cudaGetDeviceProperties(&prop, cv::gpu::getDevice()) ); |
|
|
|
|
|
|
|
|
|
Ncv32u bufSize; |
|
|
|
|
ncvSafeCall( nppiStIntegralGetSize_8u32u(roiSize, &bufSize, prop) ); |
|
|
|
|
ensureSizeIsEnough(1, bufSize, CV_8UC1, buffer); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
NppStStreamHandler h(stream); |
|
|
|
|
|
|
|
|
|
ncvSafeCall( nppiStIntegral_8u32u_C1R(const_cast<Ncv8u*>(src.ptr<Ncv8u>()), static_cast<int>(src.step), |
|
|
|
|
sum.ptr<Ncv32u>(), static_cast<int>(sum.step), roiSize, buffer.ptr<Ncv8u>(), bufSize, prop) ); |
|
|
|
|
|
|
|
|
|
if (stream == 0) |
|
|
|
|
cudaSafeCall( cudaDeviceSynchronize() ); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
// sqrIntegral
|
|
|
|
|
|
|
|
|
|
void cv::gpu::sqrIntegral(const GpuMat& src, GpuMat& sqsum, Stream& s) |
|
|
|
|
{ |
|
|
|
|
CV_Assert(src.type() == CV_8U); |
|
|
|
|
|
|
|
|
|
NcvSize32u roiSize; |
|
|
|
|
roiSize.width = src.cols; |
|
|
|
|
roiSize.height = src.rows; |
|
|
|
|
|
|
|
|
|
cudaDeviceProp prop; |
|
|
|
|
cudaSafeCall( cudaGetDeviceProperties(&prop, cv::gpu::getDevice()) ); |
|
|
|
|
|
|
|
|
|
Ncv32u bufSize; |
|
|
|
|
ncvSafeCall(nppiStSqrIntegralGetSize_8u64u(roiSize, &bufSize, prop)); |
|
|
|
|
GpuMat buf(1, bufSize, CV_8U); |
|
|
|
|
|
|
|
|
|
cudaStream_t stream = StreamAccessor::getStream(s); |
|
|
|
|
|
|
|
|
|
NppStStreamHandler h(stream); |
|
|
|
|
|
|
|
|
|
sqsum.create(src.rows + 1, src.cols + 1, CV_64F); |
|
|
|
|
ncvSafeCall(nppiStSqrIntegral_8u64u_C1R(const_cast<Ncv8u*>(src.ptr<Ncv8u>(0)), static_cast<int>(src.step), |
|
|
|
|
sqsum.ptr<Ncv64u>(0), static_cast<int>(sqsum.step), roiSize, buf.ptr<Ncv8u>(0), bufSize, prop)); |
|
|
|
|
|
|
|
|
|
if (stream == 0) |
|
|
|
|
cudaSafeCall( cudaDeviceSynchronize() ); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////
|
|
|
|
|
// Histogram
|
|
|
|
|