Merge pull request #451 from bitwangyaoyao:2.4_operator
This commit is contained in:
@@ -12,6 +12,7 @@
|
||||
//
|
||||
// Copyright (C) 2010-2012, Institute Of Software Chinese Academy Of Science, all rights reserved.
|
||||
// Copyright (C) 2010-2012, Advanced Micro Devices, Inc., all rights reserved.
|
||||
// Copyright (C) 2010-2012, Multicoreware, Inc., all rights reserved.
|
||||
// Third party copyrights are property of their respective owners.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without modification,
|
||||
@@ -48,9 +49,32 @@ namespace cv
|
||||
|
||||
namespace ocl
|
||||
{
|
||||
////////////////////////////////////OpenCL kernel strings//////////////////////////
|
||||
//extern const char *convertC3C4;
|
||||
|
||||
enum
|
||||
{
|
||||
MAT_ADD = 1,
|
||||
MAT_SUB,
|
||||
MAT_MUL,
|
||||
MAT_DIV,
|
||||
MAT_NOT,
|
||||
MAT_AND,
|
||||
MAT_OR,
|
||||
MAT_XOR
|
||||
};
|
||||
|
||||
class CV_EXPORTS oclMatExpr
|
||||
{
|
||||
public:
|
||||
oclMatExpr() : a(oclMat()), b(oclMat()), op(0) {}
|
||||
oclMatExpr(const oclMat& _a, const oclMat& _b, int _op)
|
||||
: a(_a), b(_b), op(_op) {}
|
||||
operator oclMat() const;
|
||||
void assign(oclMat& m) const;
|
||||
|
||||
protected:
|
||||
oclMat a, b;
|
||||
int op;
|
||||
};
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////// oclMat ////////////////////////////////
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
@@ -237,6 +261,12 @@ namespace cv
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline oclMat& oclMat::operator = (const oclMatExpr& expr)
|
||||
{
|
||||
expr.assign(*this);
|
||||
return *this;
|
||||
}
|
||||
|
||||
/* Fixme! To be supported in OpenCL later. */
|
||||
#if 0
|
||||
template <class T> inline oclMat::operator DevMem2D_<T>() const
|
||||
|
@@ -125,6 +125,7 @@ namespace cv
|
||||
Impl *impl;
|
||||
};
|
||||
|
||||
class CV_EXPORTS oclMatExpr;
|
||||
//////////////////////////////// oclMat ////////////////////////////////
|
||||
class CV_EXPORTS oclMat
|
||||
{
|
||||
@@ -158,7 +159,7 @@ namespace cv
|
||||
oclMat &operator = (const oclMat &m);
|
||||
//! assignment operator. Perfom blocking upload to device.
|
||||
oclMat &operator = (const Mat &m);
|
||||
|
||||
oclMat &operator = (const oclMatExpr& expr);
|
||||
|
||||
//! pefroms blocking upload data to oclMat.
|
||||
void upload(const cv::Mat &m);
|
||||
@@ -225,6 +226,11 @@ namespace cv
|
||||
oclMat operator()( Range rowRange, Range colRange ) const;
|
||||
oclMat operator()( const Rect &roi ) const;
|
||||
|
||||
oclMat& operator+=( const oclMat& m );
|
||||
oclMat& operator-=( const oclMat& m );
|
||||
oclMat& operator*=( const oclMat& m );
|
||||
oclMat& operator/=( const oclMat& m );
|
||||
|
||||
//! returns true if the oclMatrix data is continuous
|
||||
// (i.e. when there are no gaps between successive rows).
|
||||
// similar to CV_IS_oclMat_CONT(cvoclMat->type)
|
||||
@@ -297,6 +303,7 @@ namespace cv
|
||||
int wholecols;
|
||||
};
|
||||
|
||||
|
||||
///////////////////// mat split and merge /////////////////////////////////
|
||||
//! Compose a multi-channel array from several single-channel arrays
|
||||
// Support all types
|
||||
@@ -460,18 +467,23 @@ namespace cv
|
||||
// supports all types
|
||||
CV_EXPORTS void bitwise_xor(const oclMat &src1, const oclMat &src2, oclMat &dst, const oclMat &mask = oclMat());
|
||||
CV_EXPORTS void bitwise_xor(const oclMat &src1, const Scalar &s, oclMat &dst, const oclMat &mask = oclMat());
|
||||
//! computes convolution of two images
|
||||
|
||||
//! support only CV_32FC1 type
|
||||
|
||||
CV_EXPORTS void convolve(const oclMat &image, const oclMat &temp1, oclMat &result);
|
||||
|
||||
|
||||
//! Logical operators
|
||||
CV_EXPORTS oclMat operator ~ (const oclMat &src);
|
||||
CV_EXPORTS oclMat operator | (const oclMat &src1, const oclMat &src2);
|
||||
CV_EXPORTS oclMat operator & (const oclMat &src1, const oclMat &src2);
|
||||
CV_EXPORTS oclMat operator ^ (const oclMat &src1, const oclMat &src2);
|
||||
CV_EXPORTS oclMatExpr operator ~ (const oclMat &src);
|
||||
CV_EXPORTS oclMatExpr operator | (const oclMat &src1, const oclMat &src2);
|
||||
CV_EXPORTS oclMatExpr operator & (const oclMat &src1, const oclMat &src2);
|
||||
CV_EXPORTS oclMatExpr operator ^ (const oclMat &src1, const oclMat &src2);
|
||||
|
||||
//! Mathematics operators
|
||||
CV_EXPORTS oclMatExpr operator + (const oclMat &src1, const oclMat &src2);
|
||||
CV_EXPORTS oclMatExpr operator - (const oclMat &src1, const oclMat &src2);
|
||||
CV_EXPORTS oclMatExpr operator * (const oclMat &src1, const oclMat &src2);
|
||||
CV_EXPORTS oclMatExpr operator / (const oclMat &src1, const oclMat &src2);
|
||||
|
||||
//! computes convolution of two images
|
||||
//! support only CV_32FC1 type
|
||||
CV_EXPORTS void convolve(const oclMat &image, const oclMat &temp1, oclMat &result);
|
||||
|
||||
CV_EXPORTS void cvtColor(const oclMat &src, oclMat &dst, int code , int dcn = 0);
|
||||
|
||||
//////////////////////////////// Filter Engine ////////////////////////////////
|
||||
|
Reference in New Issue
Block a user