mirror of
https://github.com/opencv/opencv.git
synced 2024-11-29 13:47:32 +08:00
modified according to NPP for CUDA 3.2 API updates.
This commit is contained in:
parent
a8161b7888
commit
a5910ac068
@ -372,6 +372,7 @@ namespace cv
|
||||
//! computes norm of array
|
||||
//! Supports NORM_INF, NORM_L1, NORM_L2
|
||||
CV_EXPORTS double norm(const GpuMat& src1, int normType=NORM_L2);
|
||||
|
||||
//! computes norm of the difference between two arrays
|
||||
//! Supports NORM_INF, NORM_L1, NORM_L2
|
||||
CV_EXPORTS double norm(const GpuMat& src1, const GpuMat& src2, int normType=NORM_L2);
|
||||
@ -475,11 +476,9 @@ namespace cv
|
||||
|
||||
//! smooths the image using the normalized box filter
|
||||
CV_EXPORTS void boxFilter(const GpuMat& src, GpuMat& dst, Size ksize, Point anchor = Point(-1,-1));
|
||||
|
||||
//! a synonym for normalized box filter
|
||||
static inline void blur(const GpuMat& src, GpuMat& dst, Size ksize, Point anchor = Point(-1,-1))
|
||||
{
|
||||
boxFilter(src, dst, ksize, anchor);
|
||||
}
|
||||
static inline void blur(const GpuMat& src, GpuMat& dst, Size ksize, Point anchor = Point(-1,-1)) { boxFilter(src, dst, ksize, anchor); }
|
||||
|
||||
//! erodes the image (applies the local minimum operator)
|
||||
CV_EXPORTS void erode( const GpuMat& src, GpuMat& dst, const Mat& kernel, Point anchor, int iterations);
|
||||
|
@ -310,18 +310,25 @@ Scalar cv::gpu::sum(const GpuMat& src)
|
||||
CV_Assert(src.type() == CV_8UC1 || src.type() == CV_8UC4);
|
||||
|
||||
Scalar res;
|
||||
|
||||
|
||||
NppiSize sz;
|
||||
sz.width = src.cols;
|
||||
sz.height = src.rows;
|
||||
|
||||
int bufsz;
|
||||
|
||||
if (src.type() == CV_8UC1)
|
||||
{
|
||||
nppSafeCall( nppiSum_8u_C1R(src.ptr<Npp8u>(), src.step, sz, res.val) );
|
||||
{
|
||||
nppiReductionGetBufferHostSize_8u_C1R(sz, &bufsz);
|
||||
GpuMat buf(1, bufsz, CV_32S);
|
||||
nppSafeCall( nppiSum_8u_C1R(src.ptr<Npp8u>(), src.step, sz, buf.ptr<Npp32s>(), res.val) );
|
||||
}
|
||||
else
|
||||
{
|
||||
nppSafeCall( nppiSum_8u_C4R(src.ptr<Npp8u>(), src.step, sz, res.val) );
|
||||
{
|
||||
nppiReductionGetBufferHostSize_8u_C4R(sz, &bufsz);
|
||||
GpuMat buf(1, bufsz, CV_32S);
|
||||
nppSafeCall( nppiSum_8u_C4R(src.ptr<Npp8u>(), src.step, sz, buf.ptr<Npp32s>(), res.val) );
|
||||
}
|
||||
|
||||
return res;
|
||||
|
@ -42,6 +42,7 @@
|
||||
|
||||
#include "precomp.hpp"
|
||||
|
||||
|
||||
using namespace cv;
|
||||
using namespace cv::gpu;
|
||||
|
||||
@ -56,7 +57,7 @@ namespace
|
||||
struct NppError
|
||||
{
|
||||
int error;
|
||||
const char* str;
|
||||
string str;
|
||||
}
|
||||
npp_errors [] =
|
||||
{
|
||||
@ -95,8 +96,9 @@ namespace
|
||||
{ NPP_WRONG_INTERSECTION_QUAD_WARNING, "NPP_WRONG_INTERSECTION_QUAD_WARNING" },
|
||||
{ NPP_MISALIGNED_DST_ROI_WARNING, "NPP_MISALIGNED_DST_ROI_WARNING" },
|
||||
{ NPP_AFFINE_QUAD_INCORRECT_WARNING, "NPP_AFFINE_QUAD_INCORRECT_WARNING" },
|
||||
{ NPP_AFFINE_QUAD_CHANGED_WARNING, "NPP_AFFINE_QUAD_CHANGED_WARNING" },
|
||||
{ NPP_ADJUSTED_ROI_SIZE_WARNING, "NPP_ADJUSTED_ROI_SIZE_WARNING" },
|
||||
//disabled in NPP for cuda 3.2-rc
|
||||
//{ NPP_AFFINE_QUAD_CHANGED_WARNING, "NPP_AFFINE_QUAD_CHANGED_WARNING" },
|
||||
//{ NPP_ADJUSTED_ROI_SIZE_WARNING, "NPP_ADJUSTED_ROI_SIZE_WARNING" },
|
||||
{ NPP_DOUBLE_SIZE_WARNING, "NPP_DOUBLE_SIZE_WARNING" },
|
||||
{ NPP_ODD_ROI_WARNING, "NPP_ODD_ROI_WARNING" }
|
||||
};
|
||||
@ -116,17 +118,26 @@ namespace cv
|
||||
{
|
||||
namespace gpu
|
||||
{
|
||||
extern "C" const char* getNppErrorString( int err )
|
||||
const string getNppErrorString( int err )
|
||||
{
|
||||
int idx = std::find_if(npp_errors, npp_errors + error_num, Searcher(err)) - npp_errors;
|
||||
const string& msg = (idx != error_num) ? npp_errors[idx].str : string("Unknown error code");
|
||||
|
||||
return (idx != error_num) ? npp_errors[idx].str : "";
|
||||
std::stringstream interpreter;
|
||||
interpreter << "<" << err << "> " << msg;
|
||||
|
||||
return interpreter.str();
|
||||
}
|
||||
|
||||
extern "C" void npp_error( int err, const char *file, const int line, const char *func)
|
||||
{
|
||||
cv::error( cv::Exception(CV_GpuNppCallError, getNppErrorString(err), func, file, line) );
|
||||
}
|
||||
|
||||
extern "C" void error(const char *error_string, const char *file, const int line, const char *func)
|
||||
{
|
||||
cv::error( cv::Exception(CV_GpuApiCallError, error_string, func, file, line) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -41,16 +41,4 @@
|
||||
|
||||
#include "precomp.hpp"
|
||||
|
||||
/* End of file. */
|
||||
|
||||
|
||||
namespace cv
|
||||
{
|
||||
namespace gpu
|
||||
{
|
||||
extern "C" void error(const char *error_string, const char *file, const int line, const char *func)
|
||||
{
|
||||
cv::error( cv::Exception(CV_GpuApiCallError, error_string, func, file, line) );
|
||||
}
|
||||
}
|
||||
}
|
||||
/* End of file. */
|
@ -54,6 +54,7 @@
|
||||
#include <limits>
|
||||
#include <vector>
|
||||
#include <algorithm>
|
||||
#include <sstream>
|
||||
|
||||
#include "opencv2/gpu/gpu.hpp"
|
||||
#include "opencv2/imgproc/imgproc.hpp"
|
||||
|
Loading…
Reference in New Issue
Block a user