Added ippiMinEigenVal_ to cv::cornerMinEigenVal

pull/2605/head
Alexander Karsakov 11 years ago
parent ced81b9121
commit d9556a998f
  1. 47
      modules/imgproc/src/corner.cpp

@ -460,6 +460,53 @@ void cv::cornerMinEigenVal( InputArray _src, OutputArray _dst, int blockSize, in
Mat src = _src.getMat();
_dst.create( src.size(), CV_32FC1 );
Mat dst = _dst.getMat();
#ifdef HAVE_IPP
typedef IppStatus (CV_STDCALL * ippiMinEigenValGetBufferSize)(IppiSize, int, int, int*);
typedef IppStatus (CV_STDCALL * ippiMinEigenVal)(const void*, int, Ipp32f*, int, IppiSize, IppiKernelType, int, int, Ipp8u*);
Size srcWholeSize; Point srcOffset;
src.locateROI(srcWholeSize, srcOffset);
if (borderType == BORDER_REPLICATE && srcWholeSize == src.size())
{
IppiKernelType kerType = ksize > 0 ? ippKernelSobel : ippKernelScharr;
IppiSize srcRoi = { src.cols, src.rows };
ippiMinEigenValGetBufferSize getBufferSizeFunc = 0;
ippiMinEigenVal minEigenValFunc = 0;
float multiplier = 0.f;
if (src.type() == CV_8UC1)
{
getBufferSizeFunc = (ippiMinEigenValGetBufferSize) ippiMinEigenValGetBufferSize_8u32f_C1R;
minEigenValFunc = (ippiMinEigenVal) ippiMinEigenVal_8u32f_C1R;
multiplier = (float) 1 / 255;
} else if (src.type() == CV_32FC1)
{
getBufferSizeFunc = (ippiMinEigenValGetBufferSize) ippiMinEigenValGetBufferSize_32f_C1R;
minEigenValFunc = (ippiMinEigenVal) ippiMinEigenVal_32f_C1R;
multiplier = 255.f;
}
if (getBufferSizeFunc && minEigenValFunc)
{
int bufferSize;
IppStatus ok = getBufferSizeFunc(srcRoi, ksize, blockSize, &bufferSize);
if (ok >= 0)
{
Ipp8u* buffer = ippsMalloc_8u(bufferSize);
ok = minEigenValFunc(src.data, src.step, (Ipp32f*) dst.data, (int) dst.step, srcRoi, kerType, ksize, blockSize, buffer);
ippsFree(buffer);
if (ok >= 0)
{
dst *= multiplier;
return;
}
}
}
}
#endif
cornerEigenValsVecs( src, dst, blockSize, ksize, MINEIGENVAL, 0, borderType );
}

Loading…
Cancel
Save