Commit 5afb4452 authored by Anton Obukhov's avatar Anton Obukhov

[+] Pixel types via templates

[+] Color conversions stub via pixel types
[+] Pyramid calculation (required for mipmaps in CUDA 4.1)
[~] Changed C strings to C++ throughout NCV
[~] Fixed a couple of bugs in NCV
parent 0b192cb4
...@@ -129,7 +129,7 @@ struct cv::gpu::CascadeClassifier_GPU::CascadeClassifierImpl ...@@ -129,7 +129,7 @@ struct cv::gpu::CascadeClassifier_GPU::CascadeClassifierImpl
private: private:
static void NCVDebugOutputHandler(const char* msg) { CV_Error(CV_GpuApiCallError, msg); } static void NCVDebugOutputHandler(const std::string &msg) { CV_Error(CV_GpuApiCallError, msg.c_str()); }
NCVStatus load(const string& classifierFile) NCVStatus load(const string& classifierFile)
......
...@@ -40,10 +40,9 @@ ...@@ -40,10 +40,9 @@
//M*/ //M*/
#include <ios> #include <iostream>
#include <stdarg.h> #include <string>
#include <vector> #include <vector>
#include <cstdio>
#include "NCV.hpp" #include "NCV.hpp"
using namespace std; using namespace std;
...@@ -56,24 +55,18 @@ using namespace std; ...@@ -56,24 +55,18 @@ using namespace std;
//============================================================================== //==============================================================================
static void stdioDebugOutput(const char *msg) static void stdDebugOutput(const string &msg)
{ {
printf("%s", msg); cout << msg;
} }
static NCVDebugOutputHandler *debugOutputHandler = stdioDebugOutput; static NCVDebugOutputHandler *debugOutputHandler = stdDebugOutput;
void ncvDebugOutput(const char *msg, ...) void ncvDebugOutput(const string &msg)
{ {
const int K_DEBUG_STRING_MAXLEN = 1024; debugOutputHandler(msg);
char buffer[K_DEBUG_STRING_MAXLEN];
va_list args;
va_start(args, msg);
vsnprintf(buffer, K_DEBUG_STRING_MAXLEN, msg, args);
va_end (args);
debugOutputHandler(buffer);
} }
...@@ -288,7 +281,7 @@ NCVMemStackAllocator::NCVMemStackAllocator(NCVMemoryType memT, size_t capacity, ...@@ -288,7 +281,7 @@ NCVMemStackAllocator::NCVMemStackAllocator(NCVMemoryType memT, size_t capacity,
allocBegin = NULL; allocBegin = NULL;
if (reusePtr == NULL) if (reusePtr == NULL && capacity != 0)
{ {
bReusesMemory = false; bReusesMemory = false;
switch (memT) switch (memT)
...@@ -329,7 +322,7 @@ NCVMemStackAllocator::~NCVMemStackAllocator() ...@@ -329,7 +322,7 @@ NCVMemStackAllocator::~NCVMemStackAllocator()
{ {
ncvAssertPrintCheck(currentSize == 0, "NCVMemStackAllocator dtor:: not all objects were deallocated properly, forcing destruction"); ncvAssertPrintCheck(currentSize == 0, "NCVMemStackAllocator dtor:: not all objects were deallocated properly, forcing destruction");
if (!bReusesMemory) if (!bReusesMemory && (allocBegin != (Ncv8u *)(0x1)))
{ {
switch (_memType) switch (_memType)
{ {
...@@ -355,7 +348,7 @@ NCVStatus NCVMemStackAllocator::alloc(NCVMemSegment &seg, size_t size) ...@@ -355,7 +348,7 @@ NCVStatus NCVMemStackAllocator::alloc(NCVMemSegment &seg, size_t size)
seg.clear(); seg.clear();
ncvAssertReturn(isInitialized(), NCV_ALLOCATOR_BAD_ALLOC); ncvAssertReturn(isInitialized(), NCV_ALLOCATOR_BAD_ALLOC);
size = alignUp(static_cast<Ncv32u>(size), this->_alignment); size = alignUp(size, this->_alignment);
this->currentSize += size; this->currentSize += size;
this->_maxSize = std::max(this->_maxSize, this->currentSize); this->_maxSize = std::max(this->_maxSize, this->currentSize);
...@@ -464,7 +457,7 @@ NCVStatus NCVMemNativeAllocator::alloc(NCVMemSegment &seg, size_t size) ...@@ -464,7 +457,7 @@ NCVStatus NCVMemNativeAllocator::alloc(NCVMemSegment &seg, size_t size)
break; break;
} }
this->currentSize += alignUp(static_cast<Ncv32u>(size), this->_alignment); this->currentSize += alignUp(size, this->_alignment);
this->_maxSize = std::max(this->_maxSize, this->currentSize); this->_maxSize = std::max(this->_maxSize, this->currentSize);
seg.begin.memtype = this->_memType; seg.begin.memtype = this->_memType;
...@@ -480,8 +473,8 @@ NCVStatus NCVMemNativeAllocator::dealloc(NCVMemSegment &seg) ...@@ -480,8 +473,8 @@ NCVStatus NCVMemNativeAllocator::dealloc(NCVMemSegment &seg)
ncvAssertReturn(seg.begin.memtype == this->_memType, NCV_ALLOCATOR_BAD_DEALLOC); ncvAssertReturn(seg.begin.memtype == this->_memType, NCV_ALLOCATOR_BAD_DEALLOC);
ncvAssertReturn(seg.begin.ptr != NULL, NCV_ALLOCATOR_BAD_DEALLOC); ncvAssertReturn(seg.begin.ptr != NULL, NCV_ALLOCATOR_BAD_DEALLOC);
ncvAssertReturn(currentSize >= alignUp(static_cast<Ncv32u>(seg.size), this->_alignment), NCV_ALLOCATOR_BAD_DEALLOC); ncvAssertReturn(currentSize >= alignUp(seg.size, this->_alignment), NCV_ALLOCATOR_BAD_DEALLOC);
currentSize -= alignUp(static_cast<Ncv32u>(seg.size), this->_alignment); currentSize -= alignUp(seg.size, this->_alignment);
switch (this->_memType) switch (this->_memType)
{ {
......
...@@ -42,7 +42,7 @@ ...@@ -42,7 +42,7 @@
#ifndef _ncv_hpp_ #ifndef _ncv_hpp_
#define _ncv_hpp_ #define _ncv_hpp_
#if (defined WIN32 || defined _WIN32 || defined WINCE) && defined CVAPI_EXPORTS //&& !defined(__CUDACC__) #if (defined WIN32 || defined _WIN32 || defined WINCE) && defined CVAPI_EXPORTS
#define NCV_EXPORTS __declspec(dllexport) #define NCV_EXPORTS __declspec(dllexport)
#else #else
#define NCV_EXPORTS #define NCV_EXPORTS
...@@ -53,6 +53,8 @@ ...@@ -53,6 +53,8 @@
#endif #endif
#include <cuda_runtime.h> #include <cuda_runtime.h>
#include <sstream>
#include <iostream>
//============================================================================== //==============================================================================
...@@ -78,7 +80,7 @@ namespace NcvCTprep ...@@ -78,7 +80,7 @@ namespace NcvCTprep
} }
#define NCV_CT_PREP_PASTE_AUX(a,b) a##b ///< Concatenation indirection macro #define NCV_CT_PREP_PASTE_AUX(a,b) a##b ///< Concatenation indirection macro
#define NCV_CT_PREP_PASTE(a,b) NCV_CT_PREP_PASTE_AUX(a, b) ///< Concatenation macro #define NCV_CT_PREP_PASTE(a,b) NCV_CT_PREP_PASTE_AUX(a, b) ///< Concatenation macro
...@@ -181,6 +183,25 @@ struct NcvSize32u ...@@ -181,6 +183,25 @@ struct NcvSize32u
Ncv32u height; ///< Rectangle height. Ncv32u height; ///< Rectangle height.
__host__ __device__ NcvSize32u() : width(0), height(0) {}; __host__ __device__ NcvSize32u() : width(0), height(0) {};
__host__ __device__ NcvSize32u(Ncv32u width, Ncv32u height) : width(width), height(height) {} __host__ __device__ NcvSize32u(Ncv32u width, Ncv32u height) : width(width), height(height) {}
__host__ __device__ bool operator == (const NcvSize32u &another) const {return this->width == another.width && this->height == another.height;}
};
struct NcvPoint2D32s
{
Ncv32s x; ///< Point X.
Ncv32s y; ///< Point Y.
__host__ __device__ NcvPoint2D32s() : x(0), y(0) {};
__host__ __device__ NcvPoint2D32s(Ncv32s x, Ncv32s y) : x(x), y(y) {}
};
struct NcvPoint2D32u
{
Ncv32u x; ///< Point X.
Ncv32u y; ///< Point Y.
__host__ __device__ NcvPoint2D32u() : x(0), y(0) {};
__host__ __device__ NcvPoint2D32u(Ncv32u x, Ncv32u y) : x(x), y(y) {}
}; };
...@@ -199,6 +220,7 @@ NCV_CT_ASSERT(sizeof(NcvRect8u) == sizeof(Ncv32u)); ...@@ -199,6 +220,7 @@ NCV_CT_ASSERT(sizeof(NcvRect8u) == sizeof(Ncv32u));
NCV_CT_ASSERT(sizeof(NcvRect32s) == 4 * sizeof(Ncv32s)); NCV_CT_ASSERT(sizeof(NcvRect32s) == 4 * sizeof(Ncv32s));
NCV_CT_ASSERT(sizeof(NcvRect32u) == 4 * sizeof(Ncv32u)); NCV_CT_ASSERT(sizeof(NcvRect32u) == 4 * sizeof(Ncv32u));
NCV_CT_ASSERT(sizeof(NcvSize32u) == 2 * sizeof(Ncv32u)); NCV_CT_ASSERT(sizeof(NcvSize32u) == 2 * sizeof(Ncv32u));
NCV_CT_ASSERT(sizeof(NcvPoint2D32u) == 2 * sizeof(Ncv32u));
//============================================================================== //==============================================================================
...@@ -219,49 +241,44 @@ const Ncv32u K_LOG2_WARP_SIZE = 5; ...@@ -219,49 +241,44 @@ const Ncv32u K_LOG2_WARP_SIZE = 5;
//============================================================================== //==============================================================================
#define NCV_CT_PREP_STRINGIZE_AUX(x) #x NCV_EXPORTS void ncvDebugOutput(const std::string &msg);
#define NCV_CT_PREP_STRINGIZE(x) NCV_CT_PREP_STRINGIZE_AUX(x)
NCV_EXPORTS void ncvDebugOutput(const char *msg, ...);
typedef void NCVDebugOutputHandler(const std::string &msg);
typedef void NCVDebugOutputHandler(const char* msg);
NCV_EXPORTS void ncvSetDebugOutputHandler(NCVDebugOutputHandler* func); NCV_EXPORTS void ncvSetDebugOutputHandler(NCVDebugOutputHandler* func);
#define ncvAssertPrintCheck(pred, msg) \ #define ncvAssertPrintCheck(pred, msg) \
((pred) ? true : (ncvDebugOutput("\n%s\n", \
"NCV Assertion Failed: " msg ", file=" __FILE__ ", line=" NCV_CT_PREP_STRINGIZE(__LINE__) \
), false))
#define ncvAssertPrintReturn(pred, msg, err) \
if (ncvAssertPrintCheck(pred, msg)) ; else return err
#define ncvAssertReturn(pred, err) \
do \ do \
{ \ { \
if (!(pred)) \ if (!(pred)) \
{ \ { \
ncvDebugOutput("\n%s%d%s\n", "NCV Assertion Failed: retcode=", (int)err, ", file=" __FILE__ ", line=" NCV_CT_PREP_STRINGIZE(__LINE__)); \ std::ostringstream oss; \
return err; \ oss << "NCV Assertion Failed: " << msg << ", file=" << __FILE__ << ", line=" << __LINE__ << std::endl; \
ncvDebugOutput(oss.str()); \
} \ } \
} while (0) } while (0)
#define ncvAssertPrintReturn(pred, msg, err) \
do \
{ \
ncvAssertPrintCheck(pred, msg); \
if (!(pred)) return err; \
} while (0)
#define ncvAssertReturn(pred, err) \
ncvAssertPrintReturn(pred, "retcode=" << (int)err, err)
#define ncvAssertReturnNcvStat(ncvOp) \ #define ncvAssertReturnNcvStat(ncvOp) \
do \ do \
{ \ { \
NCVStatus _ncvStat = ncvOp; \ NCVStatus _ncvStat = ncvOp; \
if (NCV_SUCCESS != _ncvStat) \ ncvAssertPrintReturn(NCV_SUCCESS==_ncvStat, "NcvStat=" << (int)_ncvStat, _ncvStat); \
{ \
ncvDebugOutput("\n%s%d%s\n", "NCV Assertion Failed: NcvStat=", (int)_ncvStat, ", file=" __FILE__ ", line=" NCV_CT_PREP_STRINGIZE(__LINE__)); \
return _ncvStat; \
} \
} while (0) } while (0)
...@@ -270,18 +287,14 @@ NCV_EXPORTS void ncvSetDebugOutputHandler(NCVDebugOutputHandler* func); ...@@ -270,18 +287,14 @@ NCV_EXPORTS void ncvSetDebugOutputHandler(NCVDebugOutputHandler* func);
{ \ { \
cudaError_t resCall = cudacall; \ cudaError_t resCall = cudacall; \
cudaError_t resGLE = cudaGetLastError(); \ cudaError_t resGLE = cudaGetLastError(); \
if (cudaSuccess != resCall || cudaSuccess != resGLE) \ ncvAssertPrintReturn(cudaSuccess==resCall && cudaSuccess==resGLE, "cudaError_t=" << (int)(resCall | resGLE), errCode); \
{ \
ncvDebugOutput("\n%s%d%s\n", "NCV CUDA Assertion Failed: cudaError_t=", (int)(resCall | resGLE), ", file=" __FILE__ ", line=" NCV_CT_PREP_STRINGIZE(__LINE__)); \
return errCode; \
} \
} while (0) } while (0)
/** /**
* Return-codes for status notification, errors and warnings * Return-codes for status notification, errors and warnings
*/ */
enum NCVStatus enum
{ {
//NCV statuses //NCV statuses
NCV_SUCCESS, NCV_SUCCESS,
...@@ -338,9 +351,14 @@ enum NCVStatus ...@@ -338,9 +351,14 @@ enum NCVStatus
NPPST_MEM_INSUFFICIENT_BUFFER, ///< Insufficient user-allocated buffer NPPST_MEM_INSUFFICIENT_BUFFER, ///< Insufficient user-allocated buffer
NPPST_MEM_RESIDENCE_ERROR, ///< Memory residence error detected (check if pointers should be device or pinned) NPPST_MEM_RESIDENCE_ERROR, ///< Memory residence error detected (check if pointers should be device or pinned)
NPPST_MEM_INTERNAL_ERROR, ///< Internal memory management error NPPST_MEM_INTERNAL_ERROR, ///< Internal memory management error
NCV_LAST_STATUS ///< Marker to continue error numeration in other files
}; };
typedef Ncv32u NCVStatus;
#define NCV_SET_SKIP_COND(x) \ #define NCV_SET_SKIP_COND(x) \
bool __ncv_skip_cond = x bool __ncv_skip_cond = x
...@@ -774,9 +792,20 @@ public: ...@@ -774,9 +792,20 @@ public:
return ncvStat; return ncvStat;
} }
T &at(Ncv32u x, Ncv32u y) const
{
if (x >= this->_width || y >= this->_height)
{
printf("Error addressing matrix at [%d, %d]\n", x, y);
return *this->_ptr;
}
return ((T *)((Ncv8u *)this->_ptr + y * this->_pitch))[x];
}
T *ptr() const {return this->_ptr;} T *ptr() const {return this->_ptr;}
Ncv32u width() const {return this->_width;} Ncv32u width() const {return this->_width;}
Ncv32u height() const {return this->_height;} Ncv32u height() const {return this->_height;}
NcvSize32u size() const {return NcvSize32u(this->_width, this->_height);}
Ncv32u pitch() const {return this->_pitch;} Ncv32u pitch() const {return this->_pitch;}
NCVMemoryType memType() const {return this->_memtype;} NCVMemoryType memType() const {return this->_memtype;}
...@@ -923,7 +952,7 @@ public: ...@@ -923,7 +952,7 @@ public:
this->_width = roi.width; this->_width = roi.width;
this->_height = roi.height; this->_height = roi.height;
this->_pitch = mat.pitch(); this->_pitch = mat.pitch();
this->_ptr = mat.ptr() + roi.y * mat.stride() + roi.x; this->_ptr = &mat.at(roi.x, roi.y);
this->_memtype = mat.memType(); this->_memtype = mat.memType();
this->bReused = true; this->bReused = true;
...@@ -962,4 +991,24 @@ NCV_EXPORTS NCVStatus ncvDrawRects_8u_device(Ncv8u *d_dst, Ncv32u dstStride, Ncv ...@@ -962,4 +991,24 @@ NCV_EXPORTS NCVStatus ncvDrawRects_8u_device(Ncv8u *d_dst, Ncv32u dstStride, Ncv
NCV_EXPORTS NCVStatus ncvDrawRects_32u_device(Ncv32u *d_dst, Ncv32u dstStride, Ncv32u dstWidth, Ncv32u dstHeight, NCV_EXPORTS NCVStatus ncvDrawRects_32u_device(Ncv32u *d_dst, Ncv32u dstStride, Ncv32u dstWidth, Ncv32u dstHeight,
NcvRect32u *d_rects, Ncv32u numRects, Ncv32u color, cudaStream_t cuStream); NcvRect32u *d_rects, Ncv32u numRects, Ncv32u color, cudaStream_t cuStream);
#define CLAMP(x,a,b) ( (x) > (b) ? (b) : ( (x) < (a) ? (a) : (x) ) )
#define CLAMP_TOP(x, a) (((x) > (a)) ? (a) : (x))
#define CLAMP_BOTTOM(x, a) (((x) < (a)) ? (a) : (x))
#define CLAMP_0_255(x) CLAMP(x,0,255)
#define SUB_BEGIN(type, name) struct { __inline type name
#define SUB_END(name) } name;
#define SUB_CALL(name) name.name
#define SQR(x) ((x)*(x))
#define ncvSafeMatAlloc(name, type, alloc, width, height, err) \
NCVMatrixAlloc<type> name(alloc, width, height); \
ncvAssertReturn(name.isMemAllocated(), err);
#endif // _ncv_hpp_ #endif // _ncv_hpp_
/*M///////////////////////////////////////////////////////////////////////////////////////
//
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
//
// By downloading, copying, installing or using the software you agree to this license.
// If you do not agree to this license, do not download, install,
// copy or use the software.
//
//
// License Agreement
// For Open Source Computer Vision Library
//
// Copyright (C) 2009-2010, NVIDIA Corporation, all rights reserved.
// Third party copyrights are property of their respective owners.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// * Redistribution's of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
// * Redistribution's in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// * The name of the copyright holders may not be used to endorse or promote products
// derived from this software without specific prior written permission.
//
// This software is provided by the copyright holders and contributors "as is" and
// any express or implied warranties, including, but not limited to, the implied
// warranties of merchantability and fitness for a particular purpose are disclaimed.
// In no event shall the Intel Corporation or contributors be liable for any direct,
// indirect, incidental, special, exemplary, or consequential damages
// (including, but not limited to, procurement of substitute goods or services;
// loss of use, data, or profits; or business interruption) however caused
// and on any theory of liability, whether in contract, strict liability,
// or tort (including negligence or otherwise) arising in any way out of
// the use of this software, even if advised of the possibility of such damage.
//
//M*/
#ifndef _ncv_color_conversion_hpp_
#define _ncv_color_conversion_hpp_
#include "NCVPixelOperations.hpp"
enum NCVColorSpace
{
NCVColorSpaceGray,
NCVColorSpaceRGBA,
};
template<NCVColorSpace CSin, NCVColorSpace CSout, typename Tin, typename Tout> struct __pixColorConv {
static void _pixColorConv(const Tin &pixIn, Tout &pixOut);
};
template<typename Tin, typename Tout> struct __pixColorConv<NCVColorSpaceRGBA, NCVColorSpaceGray, Tin, Tout> {
static void _pixColorConv(const Tin &pixIn, Tout &pixOut)
{
Ncv32f luma = 0.299f * pixIn.x + 0.587f * pixIn.y + 0.114f * pixIn.z;
_TDemoteClampNN(luma, pixOut.x);
}};
template<typename Tin, typename Tout> struct __pixColorConv<NCVColorSpaceGray, NCVColorSpaceRGBA, Tin, Tout> {
static void _pixColorConv(const Tin &pixIn, Tout &pixOut)
{
_TDemoteClampNN(pixIn.x, pixOut.x);
_TDemoteClampNN(pixIn.x, pixOut.y);
_TDemoteClampNN(pixIn.x, pixOut.z);
pixOut.w = 0;
}};
template<NCVColorSpace CSin, NCVColorSpace CSout, typename Tin, typename Tout>
static
NCVStatus _ncvColorConv_host(const NCVMatrix<Tin> &h_imgIn,
const NCVMatrix<Tout> &h_imgOut)
{
ncvAssertReturn(h_imgIn.size() == h_imgOut.size(), NCV_DIMENSIONS_INVALID);
ncvAssertReturn(h_imgIn.memType() == h_imgOut.memType() &&
(h_imgIn.memType() == NCVMemoryTypeHostPinned || h_imgIn.memType() == NCVMemoryTypeNone), NCV_MEM_RESIDENCE_ERROR);
NCV_SET_SKIP_COND(h_imgIn.memType() == NCVMemoryTypeNone);
NCV_SKIP_COND_BEGIN
for (Ncv32u i=0; i<h_imgIn.height(); i++)
{
for (Ncv32u j=0; j<h_imgIn.width(); j++)
{
__pixColorConv<CSin, CSout, Tin, Tout>::_pixColorConv(h_imgIn.at(j,i), h_imgOut.at(j,i));
}
}
NCV_SKIP_COND_END
return NCV_SUCCESS;
}
#endif //_ncv_color_conversion_hpp_
This diff is collapsed.
This diff is collapsed.
/*M///////////////////////////////////////////////////////////////////////////////////////
//
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
//
// By downloading, copying, installing or using the software you agree to this license.
// If you do not agree to this license, do not download, install,
// copy or use the software.
//
//
// License Agreement
// For Open Source Computer Vision Library
//
// Copyright (C) 2009-2010, NVIDIA Corporation, all rights reserved.
// Third party copyrights are property of their respective owners.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// * Redistribution's of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
// * Redistribution's in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// * The name of the copyright holders may not be used to endorse or promote products
// derived from this software without specific prior written permission.
//
// This software is provided by the copyright holders and contributors "as is" and
// any express or implied warranties, including, but not limited to, the implied
// warranties of merchantability and fitness for a particular purpose are disclaimed.
// In no event shall the Intel Corporation or contributors be liable for any direct,
// indirect, incidental, special, exemplary, or consequential damages
// (including, but not limited to, procurement of substitute goods or services;
// loss of use, data, or profits; or business interruption) however caused
// and on any theory of liability, whether in contract, strict liability,
// or tort (including negligence or otherwise) arising in any way out of
// the use of this software, even if advised of the possibility of such damage.
//
//M*/
#ifndef _ncvpyramid_hpp_
#define _ncvpyramid_hpp_
#include <memory>
#include <vector>
#include "NCV.hpp"
template <class T>
class NCV_EXPORTS NCVMatrixStack
{
public:
NCVMatrixStack() {this->_arr.clear();}
~NCVMatrixStack()
{
const Ncv32u nElem = this->_arr.size();
for (Ncv32u i=0; i<nElem; i++)
{
pop_back();
}
}
void push_back(NCVMatrix<T> *elem) {this->_arr.push_back(std::tr1::shared_ptr< NCVMatrix<T> >(elem));}
void pop_back() {this->_arr.pop_back();}
NCVMatrix<T> * operator [] (int i) const {return this->_arr[i].get();}
private:
std::vector< std::tr1::shared_ptr< NCVMatrix<T> > > _arr;
};
template <class T>
class NCV_EXPORTS NCVImagePyramid
{
public:
NCVImagePyramid(const NCVMatrix<T> &img,
Ncv8u nLayers,
INCVMemAllocator &alloc,
cudaStream_t cuStream);
~NCVImagePyramid();
NcvBool isInitialized() const;
NCVStatus getLayer(NCVMatrix<T> &outImg,
NcvSize32u outRoi,
NcvBool bTrilinear,
cudaStream_t cuStream) const;
private:
NcvBool _isInitialized;
const NCVMatrix<T> *layer0;
NCVMatrixStack<T> pyramid;
Ncv32u nLayers;
};
#endif //_ncvpyramid_hpp_
...@@ -68,10 +68,7 @@ namespace ...@@ -68,10 +68,7 @@ namespace
namespace namespace
{ {
void outputHandler(const char* msg) static void outputHandler(const std::string &msg) { CV_Error(CV_GpuApiCallError, msg.c_str()); }
{
CV_Error(CV_GpuApiCallError, msg);
}
} }
void cv::gpu::BroxOpticalFlow::operator ()(const GpuMat& frame0, const GpuMat& frame1, GpuMat& u, GpuMat& v, Stream& s) void cv::gpu::BroxOpticalFlow::operator ()(const GpuMat& frame0, const GpuMat& frame1, GpuMat& u, GpuMat& v, Stream& s)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment