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
|
//! computes norm of array
|
||||||
//! Supports NORM_INF, NORM_L1, NORM_L2
|
//! Supports NORM_INF, NORM_L1, NORM_L2
|
||||||
CV_EXPORTS double norm(const GpuMat& src1, int normType=NORM_L2);
|
CV_EXPORTS double norm(const GpuMat& src1, int normType=NORM_L2);
|
||||||
|
|
||||||
//! computes norm of the difference between two arrays
|
//! computes norm of the difference between two arrays
|
||||||
//! Supports NORM_INF, NORM_L1, NORM_L2
|
//! Supports NORM_INF, NORM_L1, NORM_L2
|
||||||
CV_EXPORTS double norm(const GpuMat& src1, const GpuMat& src2, int normType=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
|
//! smooths the image using the normalized box filter
|
||||||
CV_EXPORTS void boxFilter(const GpuMat& src, GpuMat& dst, Size ksize, Point anchor = Point(-1,-1));
|
CV_EXPORTS void boxFilter(const GpuMat& src, GpuMat& dst, Size ksize, Point anchor = Point(-1,-1));
|
||||||
|
|
||||||
//! a synonym for normalized box filter
|
//! a synonym for normalized box filter
|
||||||
static inline void blur(const GpuMat& src, GpuMat& dst, Size ksize, Point anchor = Point(-1,-1))
|
static inline void blur(const GpuMat& src, GpuMat& dst, Size ksize, Point anchor = Point(-1,-1)) { boxFilter(src, dst, ksize, anchor); }
|
||||||
{
|
|
||||||
boxFilter(src, dst, ksize, anchor);
|
|
||||||
}
|
|
||||||
|
|
||||||
//! erodes the image (applies the local minimum operator)
|
//! erodes the image (applies the local minimum operator)
|
||||||
CV_EXPORTS void erode( const GpuMat& src, GpuMat& dst, const Mat& kernel, Point anchor, int iterations);
|
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);
|
CV_Assert(src.type() == CV_8UC1 || src.type() == CV_8UC4);
|
||||||
|
|
||||||
Scalar res;
|
Scalar res;
|
||||||
|
|
||||||
|
|
||||||
NppiSize sz;
|
NppiSize sz;
|
||||||
sz.width = src.cols;
|
sz.width = src.cols;
|
||||||
sz.height = src.rows;
|
sz.height = src.rows;
|
||||||
|
|
||||||
|
int bufsz;
|
||||||
|
|
||||||
if (src.type() == CV_8UC1)
|
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
|
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;
|
return res;
|
||||||
|
@ -42,6 +42,7 @@
|
|||||||
|
|
||||||
#include "precomp.hpp"
|
#include "precomp.hpp"
|
||||||
|
|
||||||
|
|
||||||
using namespace cv;
|
using namespace cv;
|
||||||
using namespace cv::gpu;
|
using namespace cv::gpu;
|
||||||
|
|
||||||
@ -56,7 +57,7 @@ namespace
|
|||||||
struct NppError
|
struct NppError
|
||||||
{
|
{
|
||||||
int error;
|
int error;
|
||||||
const char* str;
|
string str;
|
||||||
}
|
}
|
||||||
npp_errors [] =
|
npp_errors [] =
|
||||||
{
|
{
|
||||||
@ -95,8 +96,9 @@ namespace
|
|||||||
{ NPP_WRONG_INTERSECTION_QUAD_WARNING, "NPP_WRONG_INTERSECTION_QUAD_WARNING" },
|
{ NPP_WRONG_INTERSECTION_QUAD_WARNING, "NPP_WRONG_INTERSECTION_QUAD_WARNING" },
|
||||||
{ NPP_MISALIGNED_DST_ROI_WARNING, "NPP_MISALIGNED_DST_ROI_WARNING" },
|
{ NPP_MISALIGNED_DST_ROI_WARNING, "NPP_MISALIGNED_DST_ROI_WARNING" },
|
||||||
{ NPP_AFFINE_QUAD_INCORRECT_WARNING, "NPP_AFFINE_QUAD_INCORRECT_WARNING" },
|
{ NPP_AFFINE_QUAD_INCORRECT_WARNING, "NPP_AFFINE_QUAD_INCORRECT_WARNING" },
|
||||||
{ NPP_AFFINE_QUAD_CHANGED_WARNING, "NPP_AFFINE_QUAD_CHANGED_WARNING" },
|
//disabled in NPP for cuda 3.2-rc
|
||||||
{ NPP_ADJUSTED_ROI_SIZE_WARNING, "NPP_ADJUSTED_ROI_SIZE_WARNING" },
|
//{ 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_DOUBLE_SIZE_WARNING, "NPP_DOUBLE_SIZE_WARNING" },
|
||||||
{ NPP_ODD_ROI_WARNING, "NPP_ODD_ROI_WARNING" }
|
{ NPP_ODD_ROI_WARNING, "NPP_ODD_ROI_WARNING" }
|
||||||
};
|
};
|
||||||
@ -116,17 +118,26 @@ namespace cv
|
|||||||
{
|
{
|
||||||
namespace gpu
|
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;
|
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)
|
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) );
|
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"
|
#include "precomp.hpp"
|
||||||
|
|
||||||
/* End of file. */
|
/* 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) );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -54,6 +54,7 @@
|
|||||||
#include <limits>
|
#include <limits>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
#include <sstream>
|
||||||
|
|
||||||
#include "opencv2/gpu/gpu.hpp"
|
#include "opencv2/gpu/gpu.hpp"
|
||||||
#include "opencv2/imgproc/imgproc.hpp"
|
#include "opencv2/imgproc/imgproc.hpp"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user