ocl: Add dft based convolve implementation.

Match template in ocl module now can be utilized with dft based
convolve. Note this feature needs OpenCV to be built with clAmdFft
library.
This commit is contained in:
peng xiao
2013-04-08 15:19:44 +08:00
parent 67073daf19
commit 77501f3ed0
5 changed files with 432 additions and 11 deletions

View File

@@ -540,9 +540,29 @@ namespace cv
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
struct CV_EXPORTS ConvolveBuf
{
Size result_size;
Size block_size;
Size user_block_size;
Size dft_size;
oclMat image_spect, templ_spect, result_spect;
oclMat image_block, templ_block, result_data;
void create(Size image_size, Size templ_size);
static Size estimateBlockSize(Size result_size, Size templ_size);
};
//! computes convolution of two images, may use discrete Fourier transform
//! support only CV_32FC1 type
CV_EXPORTS void convolve(const oclMat &image, const oclMat &temp1, oclMat &result);
CV_EXPORTS void convolve(const oclMat &image, const oclMat &temp1, oclMat &result, bool ccorr = false);
CV_EXPORTS void convolve(const oclMat &image, const oclMat &temp1, oclMat &result, bool ccorr, ConvolveBuf& buf);
//! Performs a per-element multiplication of two Fourier spectrums.
//! Only full (not packed) CV_32FC2 complex spectrums in the interleaved format are supported for now.
//! support only CV_32FC2 type
CV_EXPORTS void mulSpectrums(const oclMat &a, const oclMat &b, oclMat &c, int flags, float scale, bool conjB = false);
CV_EXPORTS void cvtColor(const oclMat &src, oclMat &dst, int code , int dcn = 0);