Several type of formal refactoring:
1. someMatrix.data -> someMatrix.prt() 2. someMatrix.data + someMatrix.step * lineIndex -> someMatrix.ptr( lineIndex ) 3. (SomeType*) someMatrix.data -> someMatrix.ptr<SomeType>() 4. someMatrix.data -> !someMatrix.empty() ( or !someMatrix.data -> someMatrix.empty() ) in logical expressions
This commit is contained in:
@@ -472,10 +472,10 @@ void cv::accumulate( InputArray _src, InputOutputArray _dst, InputArray _mask )
|
||||
size.width *= scn;
|
||||
|
||||
if (mask.empty())
|
||||
status = ippFunc(src.data, srcstep, (Ipp32f *)dst.data, dststep, ippiSize(size.width, size.height));
|
||||
status = ippFunc(src.ptr(), srcstep, dst.ptr<Ipp32f>(), dststep, ippiSize(size.width, size.height));
|
||||
else
|
||||
status = ippFuncMask(src.data, srcstep, (const Ipp8u *)mask.data, maskstep,
|
||||
(Ipp32f *)dst.data, dststep, ippiSize(size.width, size.height));
|
||||
status = ippFuncMask(src.ptr(), srcstep, mask.ptr<Ipp8u>(), maskstep,
|
||||
dst.ptr<Ipp32f>(), dststep, ippiSize(size.width, size.height));
|
||||
|
||||
if (status >= 0)
|
||||
return;
|
||||
@@ -549,10 +549,10 @@ void cv::accumulateSquare( InputArray _src, InputOutputArray _dst, InputArray _m
|
||||
size.width *= scn;
|
||||
|
||||
if (mask.empty())
|
||||
status = ippFunc(src.data, srcstep, (Ipp32f *)dst.data, dststep, ippiSize(size.width, size.height));
|
||||
status = ippFunc(src.ptr(), srcstep, dst.ptr<Ipp32f>(), dststep, ippiSize(size.width, size.height));
|
||||
else
|
||||
status = ippFuncMask(src.data, srcstep, (const Ipp8u *)mask.data, maskstep,
|
||||
(Ipp32f *)dst.data, dststep, ippiSize(size.width, size.height));
|
||||
status = ippFuncMask(src.ptr(), srcstep, mask.ptr<Ipp8u>(), maskstep,
|
||||
dst.ptr<Ipp32f>(), dststep, ippiSize(size.width, size.height));
|
||||
|
||||
if (status >= 0)
|
||||
return;
|
||||
@@ -630,11 +630,11 @@ void cv::accumulateProduct( InputArray _src1, InputArray _src2,
|
||||
size.width *= scn;
|
||||
|
||||
if (mask.empty())
|
||||
status = ippFunc(src1.data, src1step, src2.data, src2step, (Ipp32f *)dst.data,
|
||||
status = ippFunc(src1.ptr(), src1step, src2.ptr(), src2step, dst.ptr<Ipp32f>(),
|
||||
dststep, ippiSize(size.width, size.height));
|
||||
else
|
||||
status = ippFuncMask(src1.data, src1step, src2.data, src2step, (const Ipp8u *)mask.data, maskstep,
|
||||
(Ipp32f *)dst.data, dststep, ippiSize(size.width, size.height));
|
||||
status = ippFuncMask(src1.ptr(), src1step, src2.ptr(), src2step, mask.ptr<Ipp8u>(), maskstep,
|
||||
dst.ptr<Ipp32f>(), dststep, ippiSize(size.width, size.height));
|
||||
|
||||
if (status >= 0)
|
||||
return;
|
||||
@@ -711,10 +711,10 @@ void cv::accumulateWeighted( InputArray _src, InputOutputArray _dst,
|
||||
size.width *= scn;
|
||||
|
||||
if (mask.empty())
|
||||
status = ippFunc(src.data, srcstep, (Ipp32f *)dst.data, dststep, ippiSize(size.width, size.height), (Ipp32f)alpha);
|
||||
status = ippFunc(src.ptr(), srcstep, dst.ptr<Ipp32f>(), dststep, ippiSize(size.width, size.height), (Ipp32f)alpha);
|
||||
else
|
||||
status = ippFuncMask(src.data, srcstep, (const Ipp8u *)mask.data, maskstep,
|
||||
(Ipp32f *)dst.data, dststep, ippiSize(size.width, size.height), (Ipp32f)alpha);
|
||||
status = ippFuncMask(src.ptr(), srcstep, mask.ptr<Ipp8u>(), maskstep,
|
||||
dst.ptr<Ipp32f>(), dststep, ippiSize(size.width, size.height), (Ipp32f)alpha);
|
||||
|
||||
if (status >= 0)
|
||||
return;
|
||||
|
@@ -73,20 +73,20 @@ static bool ippCanny(const Mat& _src, Mat& _dst, float low, float high)
|
||||
uchar* buffer = alignPtr((uchar*)buf, 32);
|
||||
|
||||
Mat _dx(_src.rows, _src.cols, CV_16S);
|
||||
if( ippiFilterSobelNegVertBorder_8u16s_C1R(_src.data, (int)_src.step,
|
||||
if( ippiFilterSobelNegVertBorder_8u16s_C1R(_src.ptr(), (int)_src.step,
|
||||
_dx.ptr<short>(), (int)_dx.step, roi,
|
||||
ippMskSize3x3, ippBorderRepl, 0, buffer) < 0 )
|
||||
return false;
|
||||
|
||||
Mat _dy(_src.rows, _src.cols, CV_16S);
|
||||
if( ippiFilterSobelHorizBorder_8u16s_C1R(_src.data, (int)_src.step,
|
||||
if( ippiFilterSobelHorizBorder_8u16s_C1R(_src.ptr(), (int)_src.step,
|
||||
_dy.ptr<short>(), (int)_dy.step, roi,
|
||||
ippMskSize3x3, ippBorderRepl, 0, buffer) < 0 )
|
||||
return false;
|
||||
|
||||
if( ippiCanny_16s8u_C1R(_dx.ptr<short>(), (int)_dx.step,
|
||||
_dy.ptr<short>(), (int)_dy.step,
|
||||
_dst.data, (int)_dst.step, roi, low, high, buffer) < 0 )
|
||||
_dst.ptr(), (int)_dst.step, roi, low, high, buffer) < 0 )
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
@@ -468,10 +468,10 @@ struct IPPGray2BGRAFunctor
|
||||
|
||||
const void* srcarray[3] = { src, src, src };
|
||||
Mat temp(rows, cols, CV_MAKETYPE(depth, 3));
|
||||
if(func1(srcarray, srcStep, temp.data, (int)temp.step[0], ippiSize(cols, rows)) < 0)
|
||||
if(func1(srcarray, srcStep, temp.ptr(), (int)temp.step[0], ippiSize(cols, rows)) < 0)
|
||||
return false;
|
||||
int order[4] = {0, 1, 2, 3};
|
||||
return func2(temp.data, (int)temp.step[0], dst, dstStep, ippiSize(cols, rows), order) >= 0;
|
||||
return func2(temp.ptr(), (int)temp.step[0], dst, dstStep, ippiSize(cols, rows), order) >= 0;
|
||||
}
|
||||
private:
|
||||
ippiGeneralFunc func1;
|
||||
@@ -496,9 +496,9 @@ struct IPPReorderGeneralFunctor
|
||||
|
||||
Mat temp;
|
||||
temp.create(rows, cols, CV_MAKETYPE(depth, 3));
|
||||
if(func1(src, srcStep, temp.data, (int)temp.step[0], ippiSize(cols, rows), order) < 0)
|
||||
if(func1(src, srcStep, temp.ptr(), (int)temp.step[0], ippiSize(cols, rows), order) < 0)
|
||||
return false;
|
||||
return func2(temp.data, (int)temp.step[0], dst, dstStep, ippiSize(cols, rows)) >= 0;
|
||||
return func2(temp.ptr(), (int)temp.step[0], dst, dstStep, ippiSize(cols, rows)) >= 0;
|
||||
}
|
||||
private:
|
||||
ippiReorderFunc func1;
|
||||
@@ -524,9 +524,9 @@ struct IPPGeneralReorderFunctor
|
||||
|
||||
Mat temp;
|
||||
temp.create(rows, cols, CV_MAKETYPE(depth, 3));
|
||||
if(func1(src, srcStep, temp.data, (int)temp.step[0], ippiSize(cols, rows)) < 0)
|
||||
if(func1(src, srcStep, temp.ptr(), (int)temp.step[0], ippiSize(cols, rows)) < 0)
|
||||
return false;
|
||||
return func2(temp.data, (int)temp.step[0], dst, dstStep, ippiSize(cols, rows), order) >= 0;
|
||||
return func2(temp.ptr(), (int)temp.step[0], dst, dstStep, ippiSize(cols, rows), order) >= 0;
|
||||
}
|
||||
private:
|
||||
ippiGeneralFunc func1;
|
||||
|
@@ -203,10 +203,10 @@ namespace cv{
|
||||
LabelT lunique = 1;
|
||||
//scanning phase
|
||||
for(int r_i = 0; r_i < rows; ++r_i){
|
||||
LabelT *Lrow = (LabelT *)(L.data + L.step.p[0] * r_i);
|
||||
LabelT *Lrow_prev = (LabelT *)(((char *)Lrow) - L.step.p[0]);
|
||||
const PixelT *Irow = (PixelT *)(I.data + I.step.p[0] * r_i);
|
||||
const PixelT *Irow_prev = (const PixelT *)(((char *)Irow) - I.step.p[0]);
|
||||
LabelT * const Lrow = L.ptr<LabelT>(r_i);
|
||||
LabelT * const Lrow_prev = (LabelT *)(((char *)Lrow) - L.step.p[0]);
|
||||
const PixelT * const Irow = I.ptr<PixelT>(r_i);
|
||||
const PixelT * const Irow_prev = (const PixelT *)(((char *)Irow) - I.step.p[0]);
|
||||
LabelT *Lrows[2] = {
|
||||
Lrow,
|
||||
Lrow_prev
|
||||
@@ -315,7 +315,7 @@ namespace cv{
|
||||
sop.init(nLabels);
|
||||
|
||||
for(int r_i = 0; r_i < rows; ++r_i){
|
||||
LabelT *Lrow_start = (LabelT *)(L.data + L.step.p[0] * r_i);
|
||||
LabelT *Lrow_start = L.ptr<LabelT>(r_i);
|
||||
LabelT *Lrow_end = Lrow_start + cols;
|
||||
LabelT *Lrow = Lrow_start;
|
||||
for(int c_i = 0; Lrow != Lrow_end; ++Lrow, ++c_i){
|
||||
|
@@ -1732,7 +1732,7 @@ void cv::findContours( InputOutputArray _image, OutputArrayOfArrays _contours,
|
||||
_contours.create((int)c->total, 1, CV_32SC2, i, true);
|
||||
Mat ci = _contours.getMat(i);
|
||||
CV_Assert( ci.isContinuous() );
|
||||
cvCvtSeqToArray(c, ci.data);
|
||||
cvCvtSeqToArray(c, ci.ptr());
|
||||
}
|
||||
|
||||
if( _hierarchy.needed() )
|
||||
|
@@ -146,7 +146,7 @@ void convexHull( InputArray _points, OutputArray _hull, bool clockwise, bool ret
|
||||
AutoBuffer<int> _stack(total + 2), _hullbuf(total);
|
||||
Point** pointer = _pointer;
|
||||
Point2f** pointerf = (Point2f**)pointer;
|
||||
Point* data0 = (Point*)points.data;
|
||||
Point* data0 = points.ptr<Point>();
|
||||
int* stack = _stack;
|
||||
int* hullbuf = _hullbuf;
|
||||
|
||||
@@ -257,7 +257,7 @@ void convexHull( InputArray _points, OutputArray _hull, bool clockwise, bool ret
|
||||
Mat hull = _hull.getMat();
|
||||
size_t step = !hull.isContinuous() ? hull.step[0] : sizeof(Point);
|
||||
for( i = 0; i < nout; i++ )
|
||||
*(Point*)(hull.data + i*step) = data0[hullbuf[i]];
|
||||
*(Point*)(hull.ptr() + i*step) = data0[hullbuf[i]];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -278,7 +278,7 @@ void convexityDefects( InputArray _points, InputArray _hull, OutputArray _defect
|
||||
int hpoints = hull.checkVector(1, CV_32S);
|
||||
CV_Assert( hpoints > 2 );
|
||||
|
||||
const Point* ptr = (const Point*)points.data;
|
||||
const Point* ptr = points.ptr<Point>();
|
||||
const int* hptr = hull.ptr<int>();
|
||||
std::vector<Vec4i> defects;
|
||||
|
||||
@@ -385,8 +385,8 @@ bool isContourConvex( InputArray _contour )
|
||||
return false;
|
||||
|
||||
return depth == CV_32S ?
|
||||
isContourConvex_((const Point*)contour.data, total ) :
|
||||
isContourConvex_((const Point2f*)contour.data, total );
|
||||
isContourConvex_(contour.ptr<Point>(), total ) :
|
||||
isContourConvex_(contour.ptr<Point2f>(), total );
|
||||
}
|
||||
|
||||
}
|
||||
@@ -487,7 +487,7 @@ cvConvexHull2( const CvArr* array, void* hull_storage,
|
||||
}
|
||||
}
|
||||
else
|
||||
cvSeqPushMulti(hullseq, h0.data, (int)h0.total());
|
||||
cvSeqPushMulti(hullseq, h0.ptr(), (int)h0.total());
|
||||
|
||||
if( mat )
|
||||
{
|
||||
|
@@ -62,8 +62,8 @@ static void calcMinEigenVal( const Mat& _cov, Mat& _dst )
|
||||
|
||||
for( i = 0; i < size.height; i++ )
|
||||
{
|
||||
const float* cov = (const float*)(_cov.data + _cov.step*i);
|
||||
float* dst = (float*)(_dst.data + _dst.step*i);
|
||||
const float* cov = _cov.ptr<float>(i);
|
||||
float* dst = _dst.ptr<float>(i);
|
||||
j = 0;
|
||||
#if CV_SSE
|
||||
if( simd )
|
||||
@@ -118,8 +118,8 @@ static void calcHarris( const Mat& _cov, Mat& _dst, double k )
|
||||
|
||||
for( i = 0; i < size.height; i++ )
|
||||
{
|
||||
const float* cov = (const float*)(_cov.data + _cov.step*i);
|
||||
float* dst = (float*)(_dst.data + _dst.step*i);
|
||||
const float* cov = _cov.ptr<float>(i);
|
||||
float* dst = _dst.ptr<float>(i);
|
||||
j = 0;
|
||||
|
||||
#if CV_SSE
|
||||
@@ -227,8 +227,8 @@ static void calcEigenValsVecs( const Mat& _cov, Mat& _dst )
|
||||
|
||||
for( int i = 0; i < size.height; i++ )
|
||||
{
|
||||
const float* cov = (const float*)(_cov.data + _cov.step*i);
|
||||
float* dst = (float*)(_dst.data + _dst.step*i);
|
||||
const float* cov = _cov.ptr<float>(i);
|
||||
float* dst = _dst.ptr<float>(i);
|
||||
|
||||
eigen2x2(cov, dst, size.width);
|
||||
}
|
||||
@@ -276,9 +276,9 @@ cornerEigenValsVecs( const Mat& src, Mat& eigenv, int block_size,
|
||||
|
||||
for( i = 0; i < size.height; i++ )
|
||||
{
|
||||
float* cov_data = (float*)(cov.data + i*cov.step);
|
||||
const float* dxdata = (const float*)(Dx.data + i*Dx.step);
|
||||
const float* dydata = (const float*)(Dy.data + i*Dy.step);
|
||||
float* cov_data = cov.ptr<float>(i);
|
||||
const float* dxdata = Dx.ptr<float>(i);
|
||||
const float* dydata = Dy.ptr<float>(i);
|
||||
|
||||
for( j = 0; j < size.width; j++ )
|
||||
{
|
||||
@@ -503,9 +503,9 @@ void cv::cornerMinEigenVal( InputArray _src, OutputArray _dst, int blockSize, in
|
||||
if (ok >= 0)
|
||||
{
|
||||
AutoBuffer<uchar> buffer(bufferSize);
|
||||
ok = minEigenValFunc(src.data, (int) src.step, (Ipp32f*) dst.data, (int) dst.step, srcRoi, kerType, kerSize, blockSize, buffer);
|
||||
ok = minEigenValFunc(src.ptr(), (int) src.step, dst.ptr<Ipp32f>(), (int) dst.step, srcRoi, kerType, kerSize, blockSize, buffer);
|
||||
CV_SUPPRESS_DEPRECATED_START
|
||||
if (ok >= 0) ok = ippiMulC_32f_C1IR(norm_coef, (Ipp32f*) dst.data, (int) dst.step, srcRoi);
|
||||
if (ok >= 0) ok = ippiMulC_32f_C1IR(norm_coef, dst.ptr<Ipp32f>(), (int) dst.step, srcRoi);
|
||||
CV_SUPPRESS_DEPRECATED_END
|
||||
if (ok >= 0)
|
||||
return;
|
||||
@@ -617,12 +617,12 @@ void cv::preCornerDetect( InputArray _src, OutputArray _dst, int ksize, int bord
|
||||
int i, j;
|
||||
for( i = 0; i < size.height; i++ )
|
||||
{
|
||||
float* dstdata = (float*)(dst.data + i*dst.step);
|
||||
const float* dxdata = (const float*)(Dx.data + i*Dx.step);
|
||||
const float* dydata = (const float*)(Dy.data + i*Dy.step);
|
||||
const float* d2xdata = (const float*)(D2x.data + i*D2x.step);
|
||||
const float* d2ydata = (const float*)(D2y.data + i*D2y.step);
|
||||
const float* dxydata = (const float*)(Dxy.data + i*Dxy.step);
|
||||
float* dstdata = dst.ptr<float>(i);
|
||||
const float* dxdata = Dx.ptr<float>(i);
|
||||
const float* dydata = Dy.ptr<float>(i);
|
||||
const float* d2xdata = D2x.ptr<float>(i);
|
||||
const float* d2ydata = D2y.ptr<float>(i);
|
||||
const float* dxydata = Dxy.ptr<float>(i);
|
||||
|
||||
j = 0;
|
||||
|
||||
|
@@ -54,7 +54,7 @@ void cv::cornerSubPix( InputArray _image, InputOutputArray _corners,
|
||||
cv::Mat src = _image.getMat(), cornersmat = _corners.getMat();
|
||||
int count = cornersmat.checkVector(2, CV_32F);
|
||||
CV_Assert( count >= 0 );
|
||||
Point2f* corners = (Point2f*)cornersmat.data;
|
||||
Point2f* corners = cornersmat.ptr<Point2f>();
|
||||
|
||||
if( count == 0 )
|
||||
return;
|
||||
|
@@ -515,7 +515,7 @@ public:
|
||||
const int G2Y = 9617;
|
||||
const int SHIFT = 14;
|
||||
|
||||
const T* bayer0 = (const T*)srcmat.data;
|
||||
const T* bayer0 = srcmat.ptr<T>();
|
||||
int bayer_step = (int)(srcmat.step/sizeof(T));
|
||||
T* dst0 = (T*)dstmat.data;
|
||||
int dst_step = (int)(dstmat.step/sizeof(T));
|
||||
@@ -632,7 +632,7 @@ static void Bayer2Gray_( const Mat& srcmat, Mat& dstmat, int code )
|
||||
}
|
||||
|
||||
size = dstmat.size();
|
||||
T* dst0 = (T*)dstmat.data;
|
||||
T* dst0 = dstmat.ptr<T>();
|
||||
int dst_step = (int)(dstmat.step/sizeof(T));
|
||||
if( size.height > 2 )
|
||||
for( int i = 0; i < size.width; i++ )
|
||||
@@ -676,7 +676,7 @@ public:
|
||||
int dcn2 = dcn << 1;
|
||||
|
||||
int bayer_step = (int)(srcmat.step/sizeof(T));
|
||||
const T* bayer0 = reinterpret_cast<const T*>(srcmat.data) + bayer_step * range.start;
|
||||
const T* bayer0 = srcmat.ptr<T>() + bayer_step * range.start;
|
||||
|
||||
int dst_step = (int)(dstmat.step/sizeof(T));
|
||||
T* dst0 = reinterpret_cast<T*>(dstmat.data) + (range.start + 1) * dst_step + dcn + 1;
|
||||
@@ -893,7 +893,7 @@ static void Bayer2RGB_( const Mat& srcmat, Mat& dstmat, int code )
|
||||
|
||||
// filling the first and the last rows
|
||||
size = dstmat.size();
|
||||
T* dst0 = (T*)dstmat.data;
|
||||
T* dst0 = dstmat.ptr<T>();
|
||||
if( size.height > 2 )
|
||||
for( int i = 0; i < size.width*dcn; i++ )
|
||||
{
|
||||
@@ -910,9 +910,9 @@ static void Bayer2RGB_( const Mat& srcmat, Mat& dstmat, int code )
|
||||
|
||||
static void Bayer2RGB_VNG_8u( const Mat& srcmat, Mat& dstmat, int code )
|
||||
{
|
||||
const uchar* bayer = srcmat.data;
|
||||
const uchar* bayer = srcmat.ptr();
|
||||
int bstep = (int)srcmat.step;
|
||||
uchar* dst = dstmat.data;
|
||||
uchar* dst = dstmat.ptr();
|
||||
int dststep = (int)dstmat.step;
|
||||
Size size = srcmat.size();
|
||||
|
||||
@@ -1482,7 +1482,7 @@ public:
|
||||
int sstep = int(src.step / src.elemSize1()), dstep = int(dst.step / dst.elemSize1());
|
||||
SIMDInterpolator vecOp;
|
||||
|
||||
const T* S = reinterpret_cast<const T*>(src.data + (range.start + 1) * src.step) + 1;
|
||||
const T* S = src.ptr<T>(range.start + 1) + 1;
|
||||
T* D = reinterpret_cast<T*>(dst.data + (range.start + 1) * dst.step) + dcn;
|
||||
|
||||
if (range.start % 2)
|
||||
@@ -1589,8 +1589,8 @@ static void Bayer2RGB_EdgeAware_T(const Mat& src, Mat& dst, int code)
|
||||
size = dst.size();
|
||||
size.width *= dst.channels();
|
||||
size_t dstep = dst.step / dst.elemSize1();
|
||||
T* firstRow = reinterpret_cast<T*>(dst.data);
|
||||
T* lastRow = reinterpret_cast<T*>(dst.data) + (size.height-1) * dstep;
|
||||
T* firstRow = dst.ptr<T>();
|
||||
T* lastRow = dst.ptr<T>() + (size.height-1) * dstep;
|
||||
|
||||
if (size.height > 2)
|
||||
{
|
||||
|
@@ -237,7 +237,7 @@ static bool IPPDerivScharr(InputArray _src, OutputArray _dst, int ddepth, int dx
|
||||
pBuffer = ippsMalloc_8u(bufferSize);
|
||||
if (NULL == pBuffer)
|
||||
IPP_RETURN_ERROR
|
||||
sts = ippiFilterScharrHorizMaskBorder_8u16s_C1R(src.data, (int)src.step, (Ipp16s *)dst.data, (int)dst.step, roiSize, ippMskSize3x3, ippiBorderType, 0, pBuffer);
|
||||
sts = ippiFilterScharrHorizMaskBorder_8u16s_C1R(src.ptr(), (int)src.step, dst.ptr<Ipp16s>(), (int)dst.step, roiSize, ippMskSize3x3, ippiBorderType, 0, pBuffer);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -246,7 +246,7 @@ static bool IPPDerivScharr(InputArray _src, OutputArray _dst, int ddepth, int dx
|
||||
pBuffer = ippsMalloc_8u(bufferSize);
|
||||
if (NULL == pBuffer)
|
||||
IPP_RETURN_ERROR
|
||||
sts = ippiFilterScharrVertMaskBorder_8u16s_C1R(src.data, (int)src.step, (Ipp16s *)dst.data, (int)dst.step, roiSize, ippMskSize3x3, ippiBorderType, 0, pBuffer);
|
||||
sts = ippiFilterScharrVertMaskBorder_8u16s_C1R(src.ptr(), (int)src.step, dst.ptr<Ipp16s>(), (int)dst.step, roiSize, ippMskSize3x3, ippiBorderType, 0, pBuffer);
|
||||
}
|
||||
ippsFree(pBuffer);
|
||||
}
|
||||
@@ -260,7 +260,7 @@ static bool IPPDerivScharr(InputArray _src, OutputArray _dst, int ddepth, int dx
|
||||
pBuffer = ippsMalloc_8u(bufferSize);
|
||||
if (NULL == pBuffer)
|
||||
IPP_RETURN_ERROR
|
||||
sts = ippiFilterScharrHorizMaskBorder_16s_C1R((Ipp16s *)src.data, (int)src.step, (Ipp16s *)dst.data, (int)dst.step, roiSize, ippMskSize3x3, ippiBorderType, 0, pBuffer);
|
||||
sts = ippiFilterScharrHorizMaskBorder_16s_C1R(src.ptr<Ipp16s>(), (int)src.step, dst.ptr<Ipp16s>(), (int)dst.step, roiSize, ippMskSize3x3, ippiBorderType, 0, pBuffer);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -269,7 +269,7 @@ static bool IPPDerivScharr(InputArray _src, OutputArray _dst, int ddepth, int dx
|
||||
pBuffer = ippsMalloc_8u(bufferSize);
|
||||
if (NULL == pBuffer)
|
||||
IPP_RETURN_ERROR
|
||||
sts = ippiFilterScharrVertMaskBorder_16s_C1R((Ipp16s *)src.data, (int)src.step, (Ipp16s *)dst.data, (int)dst.step, roiSize, ippMskSize3x3, ippiBorderType, 0, pBuffer);
|
||||
sts = ippiFilterScharrVertMaskBorder_16s_C1R(src.ptr<Ipp16s>(), (int)src.step, dst.ptr<Ipp16s>(), (int)dst.step, roiSize, ippMskSize3x3, ippiBorderType, 0, pBuffer);
|
||||
}
|
||||
ippsFree(pBuffer);
|
||||
}
|
||||
@@ -283,7 +283,7 @@ static bool IPPDerivScharr(InputArray _src, OutputArray _dst, int ddepth, int dx
|
||||
pBuffer = ippsMalloc_8u(bufferSize);
|
||||
if (NULL == pBuffer)
|
||||
IPP_RETURN_ERROR
|
||||
sts = ippiFilterScharrHorizMaskBorder_32f_C1R((Ipp32f *)src.data, (int)src.step, (Ipp32f *)dst.data, (int)dst.step, roiSize, ippMskSize3x3, ippiBorderType, 0, pBuffer);
|
||||
sts = ippiFilterScharrHorizMaskBorder_32f_C1R(src.ptr<Ipp32f>(), (int)src.step, dst.ptr<Ipp32f>(), (int)dst.step, roiSize, ippMskSize3x3, ippiBorderType, 0, pBuffer);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -292,14 +292,14 @@ static bool IPPDerivScharr(InputArray _src, OutputArray _dst, int ddepth, int dx
|
||||
pBuffer = ippsMalloc_8u(bufferSize);
|
||||
if (NULL == pBuffer)
|
||||
IPP_RETURN_ERROR
|
||||
sts = ippiFilterScharrVertMaskBorder_32f_C1R((Ipp32f *)src.data, (int)src.step, (Ipp32f *)dst.data, (int)dst.step, roiSize, ippMskSize3x3, ippiBorderType, 0, pBuffer);
|
||||
sts = ippiFilterScharrVertMaskBorder_32f_C1R(src.ptr<Ipp32f>(), (int)src.step, dst.ptr<Ipp32f>(), (int)dst.step, roiSize, ippMskSize3x3, ippiBorderType, 0, pBuffer);
|
||||
}
|
||||
ippsFree(pBuffer);
|
||||
if (sts < 0)
|
||||
IPP_RETURN_ERROR;
|
||||
|
||||
if (FLT_EPSILON < fabs(scale - 1.0))
|
||||
sts = ippiMulC_32f_C1R((Ipp32f *)dst.data, (int)dst.step, (Ipp32f)scale, (Ipp32f *)dst.data, (int)dst.step, roiSize);
|
||||
sts = ippiMulC_32f_C1R(dst.ptr<Ipp32f>(), (int)dst.step, (Ipp32f)scale, dst.ptr<Ipp32f>(), (int)dst.step, roiSize);
|
||||
}
|
||||
return (0 <= sts);
|
||||
}
|
||||
@@ -340,16 +340,16 @@ static bool IPPDerivScharr(InputArray _src, OutputArray _dst, int ddepth, int dx
|
||||
if (0 > ippiFilterScharrVertGetBufferSize_8u16s_C1R(roi,&bufSize))
|
||||
return false;
|
||||
buffer.allocate(bufSize);
|
||||
return (0 <= ippiFilterScharrVertBorder_8u16s_C1R((const Ipp8u*)src.data, (int)src.step,
|
||||
(Ipp16s*)dst.data, (int)dst.step, roi, ippBorderRepl, 0, (Ipp8u*)(char*)buffer));
|
||||
return (0 <= ippiFilterScharrVertBorder_8u16s_C1R(src.ptr<Ipp8u>(), (int)src.step,
|
||||
dst.ptr<Ipp16s>(), (int)dst.step, roi, ippBorderRepl, 0, (Ipp8u*)(char*)buffer));
|
||||
}
|
||||
if ((dx == 0) && (dy == 1))
|
||||
{
|
||||
if (0 > ippiFilterScharrHorizGetBufferSize_8u16s_C1R(roi,&bufSize))
|
||||
return false;
|
||||
buffer.allocate(bufSize);
|
||||
return (0 <= ippiFilterScharrHorizBorder_8u16s_C1R((const Ipp8u*)src.data, (int)src.step,
|
||||
(Ipp16s*)dst.data, (int)dst.step, roi, ippBorderRepl, 0, (Ipp8u*)(char*)buffer));
|
||||
return (0 <= ippiFilterScharrHorizBorder_8u16s_C1R(src.ptr<Ipp8u>(), (int)src.step,
|
||||
dst.ptr<Ipp16s>(), (int)dst.step, roi, ippBorderRepl, 0, (Ipp8u*)(char*)buffer));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -369,8 +369,8 @@ static bool IPPDerivScharr(InputArray _src, OutputArray _dst, int ddepth, int dx
|
||||
return false;
|
||||
buffer.allocate(bufSize);
|
||||
|
||||
if (0 > ippiFilterScharrVertBorder_32f_C1R((const Ipp32f*)src.data, (int)src.step,
|
||||
(Ipp32f*)dst.data, (int)dst.step, ippiSize(src.cols, src.rows),
|
||||
if (0 > ippiFilterScharrVertBorder_32f_C1R(src.ptr<Ipp32f>(), (int)src.step,
|
||||
dst.ptr<Ipp32f>(), (int)dst.step, ippiSize(src.cols, src.rows),
|
||||
ippBorderRepl, 0, (Ipp8u*)(char*)buffer))
|
||||
{
|
||||
return false;
|
||||
@@ -378,8 +378,8 @@ static bool IPPDerivScharr(InputArray _src, OutputArray _dst, int ddepth, int dx
|
||||
|
||||
if (scale != 1)
|
||||
/* IPP is fast, so MulC produce very little perf degradation.*/
|
||||
//ippiMulC_32f_C1IR((Ipp32f)scale, (Ipp32f*)dst.data, (int)dst.step, ippiSize(dst.cols*dst.channels(), dst.rows));
|
||||
ippiMulC_32f_C1R((Ipp32f*)dst.data, (int)dst.step, (Ipp32f)scale, (Ipp32f*)dst.data, (int)dst.step, ippiSize(dst.cols*dst.channels(), dst.rows));
|
||||
//ippiMulC_32f_C1IR((Ipp32f)scale, dst.ptr<Ipp32f>(), (int)dst.step, ippiSize(dst.cols*dst.channels(), dst.rows));
|
||||
ippiMulC_32f_C1R(dst.ptr<Ipp32f>(), (int)dst.step, (Ipp32f)scale, dst.ptr<Ipp32f>(), (int)dst.step, ippiSize(dst.cols*dst.channels(), dst.rows));
|
||||
return true;
|
||||
}
|
||||
if ((dx == 0) && (dy == 1))
|
||||
@@ -388,13 +388,13 @@ static bool IPPDerivScharr(InputArray _src, OutputArray _dst, int ddepth, int dx
|
||||
return false;
|
||||
buffer.allocate(bufSize);
|
||||
|
||||
if (0 > ippiFilterScharrHorizBorder_32f_C1R((const Ipp32f*)src.data, (int)src.step,
|
||||
(Ipp32f*)dst.data, (int)dst.step, ippiSize(src.cols, src.rows),
|
||||
if (0 > ippiFilterScharrHorizBorder_32f_C1R(src.ptr<Ipp32f>(), (int)src.step,
|
||||
dst.ptr<Ipp32f>(), (int)dst.step, ippiSize(src.cols, src.rows),
|
||||
ippBorderRepl, 0, (Ipp8u*)(char*)buffer))
|
||||
return false;
|
||||
|
||||
if (scale != 1)
|
||||
ippiMulC_32f_C1R((Ipp32f *)dst.data, (int)dst.step, (Ipp32f)scale, (Ipp32f *)dst.data, (int)dst.step, ippiSize(dst.cols*dst.channels(), dst.rows));
|
||||
ippiMulC_32f_C1R(dst.ptr<Ipp32f>(), (int)dst.step, (Ipp32f)scale, dst.ptr<Ipp32f>(), (int)dst.step, ippiSize(dst.cols*dst.channels(), dst.rows));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -431,8 +431,8 @@ static bool IPPDerivSobel(InputArray _src, OutputArray _dst, int ddepth, int dx,
|
||||
IPP_RETURN_ERROR
|
||||
buffer.allocate(bufSize);
|
||||
|
||||
if (0 > ippiFilterSobelNegVertBorder_8u16s_C1R((const Ipp8u*)src.data, (int)src.step,
|
||||
(Ipp16s*)dst.data, (int)dst.step, ippiSize(src.cols, src.rows), (IppiMaskSize)(ksize*10+ksize),
|
||||
if (0 > ippiFilterSobelNegVertBorder_8u16s_C1R(src.ptr<Ipp8u>(), (int)src.step,
|
||||
dst.ptr<Ipp16s>(), (int)dst.step, ippiSize(src.cols, src.rows), (IppiMaskSize)(ksize*10+ksize),
|
||||
ippBorderRepl, 0, (Ipp8u*)(char*)buffer))
|
||||
IPP_RETURN_ERROR
|
||||
return true;
|
||||
@@ -444,8 +444,8 @@ static bool IPPDerivSobel(InputArray _src, OutputArray _dst, int ddepth, int dx,
|
||||
IPP_RETURN_ERROR
|
||||
buffer.allocate(bufSize);
|
||||
|
||||
if (0 > ippiFilterSobelHorizBorder_8u16s_C1R((const Ipp8u*)src.data, (int)src.step,
|
||||
(Ipp16s*)dst.data, (int)dst.step, ippiSize(src.cols, src.rows), (IppiMaskSize)(ksize*10+ksize),
|
||||
if (0 > ippiFilterSobelHorizBorder_8u16s_C1R(src.ptr<Ipp8u>(), (int)src.step,
|
||||
dst.ptr<Ipp16s>(), (int)dst.step, ippiSize(src.cols, src.rows), (IppiMaskSize)(ksize*10+ksize),
|
||||
ippBorderRepl, 0, (Ipp8u*)(char*)buffer))
|
||||
IPP_RETURN_ERROR
|
||||
return true;
|
||||
@@ -458,8 +458,8 @@ static bool IPPDerivSobel(InputArray _src, OutputArray _dst, int ddepth, int dx,
|
||||
IPP_RETURN_ERROR
|
||||
buffer.allocate(bufSize);
|
||||
|
||||
if (0 > ippiFilterSobelVertSecondBorder_8u16s_C1R((const Ipp8u*)src.data, (int)src.step,
|
||||
(Ipp16s*)dst.data, (int)dst.step, ippiSize(src.cols, src.rows), (IppiMaskSize)(ksize*10+ksize),
|
||||
if (0 > ippiFilterSobelVertSecondBorder_8u16s_C1R(src.ptr<Ipp8u>(), (int)src.step,
|
||||
dst.ptr<Ipp16s>(), (int)dst.step, ippiSize(src.cols, src.rows), (IppiMaskSize)(ksize*10+ksize),
|
||||
ippBorderRepl, 0, (Ipp8u*)(char*)buffer))
|
||||
IPP_RETURN_ERROR
|
||||
return true;
|
||||
@@ -471,8 +471,8 @@ static bool IPPDerivSobel(InputArray _src, OutputArray _dst, int ddepth, int dx,
|
||||
IPP_RETURN_ERROR
|
||||
buffer.allocate(bufSize);
|
||||
|
||||
if (0 > ippiFilterSobelHorizSecondBorder_8u16s_C1R((const Ipp8u*)src.data, (int)src.step,
|
||||
(Ipp16s*)dst.data, (int)dst.step, ippiSize(src.cols, src.rows), (IppiMaskSize)(ksize*10+ksize),
|
||||
if (0 > ippiFilterSobelHorizSecondBorder_8u16s_C1R(src.ptr<Ipp8u>(), (int)src.step,
|
||||
dst.ptr<Ipp16s>(), (int)dst.step, ippiSize(src.cols, src.rows), (IppiMaskSize)(ksize*10+ksize),
|
||||
ippBorderRepl, 0, (Ipp8u*)(char*)buffer))
|
||||
IPP_RETURN_ERROR
|
||||
return true;
|
||||
@@ -489,12 +489,12 @@ static bool IPPDerivSobel(InputArray _src, OutputArray _dst, int ddepth, int dx,
|
||||
IPP_RETURN_ERROR
|
||||
buffer.allocate(bufSize);
|
||||
|
||||
if (0 > ippiFilterSobelNegVertBorder_32f_C1R((const Ipp32f*)src.data, (int)src.step,
|
||||
(Ipp32f*)dst.data, (int)dst.step, ippiSize(src.cols, src.rows), (IppiMaskSize)(ksize*10+ksize),
|
||||
if (0 > ippiFilterSobelNegVertBorder_32f_C1R(src.ptr<Ipp32f>(), (int)src.step,
|
||||
dst.ptr<Ipp32f>(), (int)dst.step, ippiSize(src.cols, src.rows), (IppiMaskSize)(ksize*10+ksize),
|
||||
ippBorderRepl, 0, (Ipp8u*)(char*)buffer))
|
||||
IPP_RETURN_ERROR
|
||||
if(scale != 1)
|
||||
ippiMulC_32f_C1R((Ipp32f *)dst.data, (int)dst.step, (Ipp32f)scale, (Ipp32f *)dst.data, (int)dst.step, ippiSize(dst.cols*dst.channels(), dst.rows));
|
||||
ippiMulC_32f_C1R(dst.ptr<Ipp32f>(), (int)dst.step, (Ipp32f)scale, dst.ptr<Ipp32f>(), (int)dst.step, ippiSize(dst.cols*dst.channels(), dst.rows));
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -503,12 +503,12 @@ static bool IPPDerivSobel(InputArray _src, OutputArray _dst, int ddepth, int dx,
|
||||
if (0 > ippiFilterSobelHorizGetBufferSize_32f_C1R(ippiSize(src.cols, src.rows), (IppiMaskSize)(ksize*10+ksize),&bufSize))
|
||||
IPP_RETURN_ERROR
|
||||
buffer.allocate(bufSize);
|
||||
if (0 > ippiFilterSobelHorizBorder_32f_C1R((const Ipp32f*)src.data, (int)src.step,
|
||||
(Ipp32f*)dst.data, (int)dst.step, ippiSize(src.cols, src.rows), (IppiMaskSize)(ksize*10+ksize),
|
||||
if (0 > ippiFilterSobelHorizBorder_32f_C1R(src.ptr<Ipp32f>(), (int)src.step,
|
||||
dst.ptr<Ipp32f>(), (int)dst.step, ippiSize(src.cols, src.rows), (IppiMaskSize)(ksize*10+ksize),
|
||||
ippBorderRepl, 0, (Ipp8u*)(char*)buffer))
|
||||
IPP_RETURN_ERROR
|
||||
if(scale != 1)
|
||||
ippiMulC_32f_C1R((Ipp32f *)dst.data, (int)dst.step, (Ipp32f)scale, (Ipp32f *)dst.data, (int)dst.step, ippiSize(dst.cols*dst.channels(), dst.rows));
|
||||
ippiMulC_32f_C1R(dst.ptr<Ipp32f>(), (int)dst.step, (Ipp32f)scale, dst.ptr<Ipp32f>(), (int)dst.step, ippiSize(dst.cols*dst.channels(), dst.rows));
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
@@ -519,12 +519,12 @@ static bool IPPDerivSobel(InputArray _src, OutputArray _dst, int ddepth, int dx,
|
||||
IPP_RETURN_ERROR
|
||||
buffer.allocate(bufSize);
|
||||
|
||||
if (0 > ippiFilterSobelVertSecondBorder_32f_C1R((const Ipp32f*)src.data, (int)src.step,
|
||||
(Ipp32f*)dst.data, (int)dst.step, ippiSize(src.cols, src.rows), (IppiMaskSize)(ksize*10+ksize),
|
||||
if (0 > ippiFilterSobelVertSecondBorder_32f_C1R(src.ptr<Ipp32f>(), (int)src.step,
|
||||
dst.ptr<Ipp32f>(), (int)dst.step, ippiSize(src.cols, src.rows), (IppiMaskSize)(ksize*10+ksize),
|
||||
ippBorderRepl, 0, (Ipp8u*)(char*)buffer))
|
||||
IPP_RETURN_ERROR
|
||||
if(scale != 1)
|
||||
ippiMulC_32f_C1R((Ipp32f *)dst.data, (int)dst.step, (Ipp32f)scale, (Ipp32f *)dst.data, (int)dst.step, ippiSize(dst.cols*dst.channels(), dst.rows));
|
||||
ippiMulC_32f_C1R(dst.ptr<Ipp32f>(), (int)dst.step, (Ipp32f)scale, dst.ptr<Ipp32f>(), (int)dst.step, ippiSize(dst.cols*dst.channels(), dst.rows));
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -534,13 +534,13 @@ static bool IPPDerivSobel(InputArray _src, OutputArray _dst, int ddepth, int dx,
|
||||
IPP_RETURN_ERROR
|
||||
buffer.allocate(bufSize);
|
||||
|
||||
if (0 > ippiFilterSobelHorizSecondBorder_32f_C1R((const Ipp32f*)src.data, (int)src.step,
|
||||
(Ipp32f*)dst.data, (int)dst.step, ippiSize(src.cols, src.rows), (IppiMaskSize)(ksize*10+ksize),
|
||||
if (0 > ippiFilterSobelHorizSecondBorder_32f_C1R(src.ptr<Ipp32f>(), (int)src.step,
|
||||
dst.ptr<Ipp32f>(), (int)dst.step, ippiSize(src.cols, src.rows), (IppiMaskSize)(ksize*10+ksize),
|
||||
ippBorderRepl, 0, (Ipp8u*)(char*)buffer))
|
||||
IPP_RETURN_ERROR
|
||||
|
||||
if(scale != 1)
|
||||
ippiMulC_32f_C1R((Ipp32f *)dst.data, (int)dst.step, (Ipp32f)scale, (Ipp32f *)dst.data, (int)dst.step, ippiSize(dst.cols*dst.channels(), dst.rows));
|
||||
ippiMulC_32f_C1R(dst.ptr<Ipp32f>(), (int)dst.step, (Ipp32f)scale, dst.ptr<Ipp32f>(), (int)dst.step, ippiSize(dst.cols*dst.channels(), dst.rows));
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
@@ -724,7 +724,7 @@ void cv::Laplacian( InputArray _src, OutputArray _dst, int ddepth, int ksize,
|
||||
if (borderTypeIpp >= 0 && ippiFilterLaplacianGetBufferSize_##ippfavor##_C1R(roisize, masksize, &bufsize) >= 0) \
|
||||
{ \
|
||||
Ipp8u * buffer = ippsMalloc_8u(bufsize); \
|
||||
status = ippiFilterLaplacianBorder_##ippfavor##_C1R((const ippsrctype *)src.data, (int)src.step, (ippdsttype *)dst.data, \
|
||||
status = ippiFilterLaplacianBorder_##ippfavor##_C1R(src.ptr<ippsrctype>(), (int)src.step, dst.ptr<ippdsttype>(), \
|
||||
(int)dst.step, roisize, masksize, borderTypeIpp, 0, buffer); \
|
||||
ippsFree(buffer); \
|
||||
} \
|
||||
@@ -736,18 +736,18 @@ void cv::Laplacian( InputArray _src, OutputArray _dst, int ddepth, int ksize,
|
||||
IPP_FILTER_LAPLACIAN(Ipp8u, Ipp16s, 8u16s);
|
||||
|
||||
if (needScale && status >= 0)
|
||||
status = ippiMulC_16s_C1IRSfs((Ipp16s)iscale, (Ipp16s *)dst.data, (int)dst.step, roisize, 0);
|
||||
status = ippiMulC_16s_C1IRSfs((Ipp16s)iscale, dst.ptr<Ipp16s>(), (int)dst.step, roisize, 0);
|
||||
if (needDelta && status >= 0)
|
||||
status = ippiAddC_16s_C1IRSfs((Ipp16s)idelta, (Ipp16s *)dst.data, (int)dst.step, roisize, 0);
|
||||
status = ippiAddC_16s_C1IRSfs((Ipp16s)idelta, dst.ptr<Ipp16s>(), (int)dst.step, roisize, 0);
|
||||
}
|
||||
else if (sdepth == CV_32F && ddepth == CV_32F)
|
||||
{
|
||||
IPP_FILTER_LAPLACIAN(Ipp32f, Ipp32f, 32f);
|
||||
|
||||
if (needScale && status >= 0)
|
||||
status = ippiMulC_32f_C1IR((Ipp32f)scale, (Ipp32f *)dst.data, (int)dst.step, roisize);
|
||||
status = ippiMulC_32f_C1IR((Ipp32f)scale, dst.ptr<Ipp32f>(), (int)dst.step, roisize);
|
||||
if (needDelta && status >= 0)
|
||||
status = ippiAddC_32f_C1IR((Ipp32f)delta, (Ipp32f *)dst.data, (int)dst.step, roisize);
|
||||
status = ippiAddC_32f_C1IR((Ipp32f)delta, dst.ptr<Ipp32f>(), (int)dst.step, roisize);
|
||||
}
|
||||
CV_SUPPRESS_DEPRECATED_END
|
||||
|
||||
@@ -805,7 +805,7 @@ void cv::Laplacian( InputArray _src, OutputArray _dst, int ddepth, int ksize,
|
||||
Mat src = _src.getMat(), dst = _dst.getMat();
|
||||
int y = fx->start(src), dsty = 0, dy = 0;
|
||||
fy->start(src);
|
||||
const uchar* sptr = src.data + y*src.step;
|
||||
const uchar* sptr = src.ptr(y);
|
||||
|
||||
int dy0 = std::min(std::max((int)(STRIPE_SIZE/(CV_ELEM_SIZE(stype)*src.cols)), 1), src.rows);
|
||||
Mat d2x( dy0 + kd.rows - 1, src.cols, wtype );
|
||||
@@ -813,8 +813,8 @@ void cv::Laplacian( InputArray _src, OutputArray _dst, int ddepth, int ksize,
|
||||
|
||||
for( ; dsty < src.rows; sptr += dy0*src.step, dsty += dy )
|
||||
{
|
||||
fx->proceed( sptr, (int)src.step, dy0, d2x.data, (int)d2x.step );
|
||||
dy = fy->proceed( sptr, (int)src.step, dy0, d2y.data, (int)d2y.step );
|
||||
fx->proceed( sptr, (int)src.step, dy0, d2x.ptr(), (int)d2x.step );
|
||||
dy = fy->proceed( sptr, (int)src.step, dy0, d2y.ptr(), (int)d2y.step );
|
||||
if( dy > 0 )
|
||||
{
|
||||
Mat dstripe = dst.rowRange(dsty, dsty + dy);
|
||||
|
@@ -75,7 +75,7 @@ distanceTransform_3x3( const Mat& _src, Mat& _temp, Mat& _dist, const float* met
|
||||
const int DIAG_DIST = CV_FLT_TO_FIX( metrics[1], DIST_SHIFT );
|
||||
const float scale = 1.f/(1 << DIST_SHIFT);
|
||||
|
||||
const uchar* src = _src.data;
|
||||
const uchar* src = _src.ptr();
|
||||
int* temp = _temp.ptr<int>();
|
||||
float* dist = _dist.ptr<float>();
|
||||
int srcstep = (int)(_src.step/sizeof(src[0]));
|
||||
@@ -149,7 +149,7 @@ distanceTransform_5x5( const Mat& _src, Mat& _temp, Mat& _dist, const float* met
|
||||
const int LONG_DIST = CV_FLT_TO_FIX( metrics[2], DIST_SHIFT );
|
||||
const float scale = 1.f/(1 << DIST_SHIFT);
|
||||
|
||||
const uchar* src = _src.data;
|
||||
const uchar* src = _src.ptr();
|
||||
int* temp = _temp.ptr<int>();
|
||||
float* dist = _dist.ptr<float>();
|
||||
int srcstep = (int)(_src.step/sizeof(src[0]));
|
||||
@@ -240,7 +240,7 @@ distanceTransformEx_5x5( const Mat& _src, Mat& _temp, Mat& _dist, Mat& _labels,
|
||||
const int LONG_DIST = CV_FLT_TO_FIX( metrics[2], DIST_SHIFT );
|
||||
const float scale = 1.f/(1 << DIST_SHIFT);
|
||||
|
||||
const uchar* src = _src.data;
|
||||
const uchar* src = _src.ptr();
|
||||
int* temp = _temp.ptr<int>();
|
||||
float* dist = _dist.ptr<float>();
|
||||
int* labels = _labels.ptr<int>();
|
||||
@@ -609,8 +609,8 @@ distanceATS_L1_8u( const Mat& src, Mat& dst )
|
||||
uchar lut[256];
|
||||
int x, y;
|
||||
|
||||
const uchar *sbase = src.data;
|
||||
uchar *dbase = dst.data;
|
||||
const uchar *sbase = src.ptr();
|
||||
uchar *dbase = dst.ptr();
|
||||
int srcstep = (int)src.step;
|
||||
int dststep = (int)dst.step;
|
||||
|
||||
|
@@ -329,7 +329,7 @@ void cv::goodFeaturesToTrack( InputArray _image, OutputArray _corners,
|
||||
|
||||
for( i = 0; i < total; i++ )
|
||||
{
|
||||
int ofs = (int)((const uchar*)tmpCorners[i] - eig.data);
|
||||
int ofs = (int)((const uchar*)tmpCorners[i] - eig.ptr());
|
||||
int y = (int)(ofs / eig.step);
|
||||
int x = (int)((ofs - y*eig.step)/sizeof(float));
|
||||
|
||||
@@ -388,7 +388,7 @@ void cv::goodFeaturesToTrack( InputArray _image, OutputArray _corners,
|
||||
{
|
||||
for( i = 0; i < total; i++ )
|
||||
{
|
||||
int ofs = (int)((const uchar*)tmpCorners[i] - eig.data);
|
||||
int ofs = (int)((const uchar*)tmpCorners[i] - eig.ptr());
|
||||
int y = (int)(ofs / eig.step);
|
||||
int x = (int)((ofs - y*eig.step)/sizeof(float));
|
||||
|
||||
|
@@ -410,10 +410,10 @@ void FilterEngine::apply(const Mat& src, Mat& dst,
|
||||
dstOfs.y + srcRoi.height <= dst.rows );
|
||||
|
||||
int y = start(src, srcRoi, isolated);
|
||||
proceed( src.data + y*src.step
|
||||
proceed( src.ptr(y)
|
||||
+ srcRoi.x*src.elemSize(),
|
||||
(int)src.step, endY - startY,
|
||||
dst.data + dstOfs.y*dst.step +
|
||||
dst.ptr(dstOfs.y) +
|
||||
dstOfs.x*dst.elemSize(), (int)dst.step );
|
||||
}
|
||||
|
||||
@@ -432,7 +432,7 @@ int cv::getKernelType(InputArray filter_kernel, Point anchor)
|
||||
Mat kernel;
|
||||
_kernel.convertTo(kernel, CV_64F);
|
||||
|
||||
const double* coeffs = (double*)kernel.data;
|
||||
const double* coeffs = kernel.ptr<double>();
|
||||
double sum = 0;
|
||||
int type = KERNEL_SMOOTH + KERNEL_INTEGER;
|
||||
if( (_kernel.rows == 1 || _kernel.cols == 1) &&
|
||||
@@ -513,7 +513,7 @@ struct RowVec_8u32s
|
||||
int k, ksize = kernel.rows + kernel.cols - 1;
|
||||
for( k = 0; k < ksize; k++ )
|
||||
{
|
||||
int v = ((const int*)kernel.data)[k];
|
||||
int v = kernel.ptr<int>()[k];
|
||||
if( v < SHRT_MIN || v > SHRT_MAX )
|
||||
{
|
||||
smallValues = false;
|
||||
@@ -529,7 +529,7 @@ struct RowVec_8u32s
|
||||
|
||||
int i = 0, k, _ksize = kernel.rows + kernel.cols - 1;
|
||||
int* dst = (int*)_dst;
|
||||
const int* _kx = (const int*)kernel.data;
|
||||
const int* _kx = kernel.ptr<int>();
|
||||
width *= cn;
|
||||
|
||||
if( smallValues )
|
||||
@@ -605,7 +605,7 @@ struct SymmRowSmallVec_8u32s
|
||||
int k, ksize = kernel.rows + kernel.cols - 1;
|
||||
for( k = 0; k < ksize; k++ )
|
||||
{
|
||||
int v = ((const int*)kernel.data)[k];
|
||||
int v = kernel.ptr<int>()[k];
|
||||
if( v < SHRT_MIN || v > SHRT_MAX )
|
||||
{
|
||||
smallValues = false;
|
||||
@@ -622,7 +622,7 @@ struct SymmRowSmallVec_8u32s
|
||||
int i = 0, j, k, _ksize = kernel.rows + kernel.cols - 1;
|
||||
int* dst = (int*)_dst;
|
||||
bool symmetrical = (symmetryType & KERNEL_SYMMETRICAL) != 0;
|
||||
const int* kx = (const int*)kernel.data + _ksize/2;
|
||||
const int* kx = kernel.ptr<int>() + _ksize/2;
|
||||
if( !smallValues )
|
||||
return 0;
|
||||
|
||||
@@ -941,7 +941,7 @@ struct SymmColumnVec_32s8u
|
||||
return 0;
|
||||
|
||||
int ksize2 = (kernel.rows + kernel.cols - 1)/2;
|
||||
const float* ky = (const float*)kernel.data + ksize2;
|
||||
const float* ky = kernel.ptr<float>() + ksize2;
|
||||
int i = 0, k;
|
||||
bool symmetrical = (symmetryType & KERNEL_SYMMETRICAL) != 0;
|
||||
const int** src = (const int**)_src;
|
||||
@@ -1089,7 +1089,7 @@ struct SymmColumnSmallVec_32s16s
|
||||
return 0;
|
||||
|
||||
int ksize2 = (kernel.rows + kernel.cols - 1)/2;
|
||||
const float* ky = (const float*)kernel.data + ksize2;
|
||||
const float* ky = kernel.ptr<float>() + ksize2;
|
||||
int i = 0;
|
||||
bool symmetrical = (symmetryType & KERNEL_SYMMETRICAL) != 0;
|
||||
const int** src = (const int**)_src;
|
||||
@@ -1222,7 +1222,7 @@ struct RowVec_16s32f
|
||||
|
||||
int i = 0, k, _ksize = kernel.rows + kernel.cols - 1;
|
||||
float* dst = (float*)_dst;
|
||||
const float* _kx = (const float*)kernel.data;
|
||||
const float* _kx = kernel.ptr<float>();
|
||||
width *= cn;
|
||||
|
||||
for( ; i <= width - 8; i += 8 )
|
||||
@@ -1271,7 +1271,7 @@ struct SymmColumnVec_32f16s
|
||||
return 0;
|
||||
|
||||
int ksize2 = (kernel.rows + kernel.cols - 1)/2;
|
||||
const float* ky = (const float*)kernel.data + ksize2;
|
||||
const float* ky = kernel.ptr<float>() + ksize2;
|
||||
int i = 0, k;
|
||||
bool symmetrical = (symmetryType & KERNEL_SYMMETRICAL) != 0;
|
||||
const float** src = (const float**)_src;
|
||||
@@ -1431,7 +1431,7 @@ struct RowVec_32f
|
||||
int _ksize = kernel.rows + kernel.cols - 1;
|
||||
const float* src0 = (const float*)_src;
|
||||
float* dst = (float*)_dst;
|
||||
const float* _kx = (const float*)kernel.data;
|
||||
const float* _kx = kernel.ptr<float>();
|
||||
|
||||
if( !haveSSE )
|
||||
return 0;
|
||||
@@ -1519,7 +1519,7 @@ struct SymmRowSmallVec_32f
|
||||
float* dst = (float*)_dst;
|
||||
const float* src = (const float*)_src + (_ksize/2)*cn;
|
||||
bool symmetrical = (symmetryType & KERNEL_SYMMETRICAL) != 0;
|
||||
const float* kx = (const float*)kernel.data + _ksize/2;
|
||||
const float* kx = kernel.ptr<float>() + _ksize/2;
|
||||
width *= cn;
|
||||
|
||||
if( symmetrical )
|
||||
@@ -1711,7 +1711,7 @@ struct SymmColumnVec_32f
|
||||
return 0;
|
||||
|
||||
int ksize2 = (kernel.rows + kernel.cols - 1)/2;
|
||||
const float* ky = (const float*)kernel.data + ksize2;
|
||||
const float* ky = kernel.ptr<float>() + ksize2;
|
||||
int i = 0, k;
|
||||
bool symmetrical = (symmetryType & KERNEL_SYMMETRICAL) != 0;
|
||||
const float** src = (const float**)_src;
|
||||
@@ -1851,7 +1851,7 @@ struct SymmColumnSmallVec_32f
|
||||
return 0;
|
||||
|
||||
int ksize2 = (kernel.rows + kernel.cols - 1)/2;
|
||||
const float* ky = (const float*)kernel.data + ksize2;
|
||||
const float* ky = kernel.ptr<float>() + ksize2;
|
||||
int i = 0;
|
||||
bool symmetrical = (symmetryType & KERNEL_SYMMETRICAL) != 0;
|
||||
const float** src = (const float**)_src;
|
||||
@@ -2241,7 +2241,7 @@ template<typename ST, typename DT, class VecOp> struct RowFilter : public BaseRo
|
||||
void operator()(const uchar* src, uchar* dst, int width, int cn)
|
||||
{
|
||||
int _ksize = ksize;
|
||||
const DT* kx = (const DT*)kernel.data;
|
||||
const DT* kx = kernel.ptr<DT>();
|
||||
const ST* S;
|
||||
DT* D = (DT*)dst;
|
||||
int i, k;
|
||||
@@ -2299,7 +2299,7 @@ template<typename ST, typename DT, class VecOp> struct SymmRowSmallFilter :
|
||||
void operator()(const uchar* src, uchar* dst, int width, int cn)
|
||||
{
|
||||
int ksize2 = this->ksize/2, ksize2n = ksize2*cn;
|
||||
const DT* kx = (const DT*)this->kernel.data + ksize2;
|
||||
const DT* kx = this->kernel.ptr<DT>() + ksize2;
|
||||
bool symmetrical = (this->symmetryType & KERNEL_SYMMETRICAL) != 0;
|
||||
DT* D = (DT*)dst;
|
||||
int i = this->vecOp(src, dst, width, cn), j, k;
|
||||
@@ -2437,7 +2437,7 @@ template<class CastOp, class VecOp> struct ColumnFilter : public BaseColumnFilte
|
||||
|
||||
void operator()(const uchar** src, uchar* dst, int dststep, int count, int width)
|
||||
{
|
||||
const ST* ky = (const ST*)kernel.data;
|
||||
const ST* ky = kernel.ptr<ST>();
|
||||
ST _delta = delta;
|
||||
int _ksize = ksize;
|
||||
int i, k;
|
||||
@@ -2501,7 +2501,7 @@ template<class CastOp, class VecOp> struct SymmColumnFilter : public ColumnFilte
|
||||
void operator()(const uchar** src, uchar* dst, int dststep, int count, int width)
|
||||
{
|
||||
int ksize2 = this->ksize/2;
|
||||
const ST* ky = (const ST*)this->kernel.data + ksize2;
|
||||
const ST* ky = this->kernel.ptr<ST>() + ksize2;
|
||||
int i, k;
|
||||
bool symmetrical = (symmetryType & KERNEL_SYMMETRICAL) != 0;
|
||||
ST _delta = this->delta;
|
||||
@@ -2607,7 +2607,7 @@ struct SymmColumnSmallFilter : public SymmColumnFilter<CastOp, VecOp>
|
||||
void operator()(const uchar** src, uchar* dst, int dststep, int count, int width)
|
||||
{
|
||||
int ksize2 = this->ksize/2;
|
||||
const ST* ky = (const ST*)this->kernel.data + ksize2;
|
||||
const ST* ky = this->kernel.ptr<ST>() + ksize2;
|
||||
int i;
|
||||
bool symmetrical = (this->symmetryType & KERNEL_SYMMETRICAL) != 0;
|
||||
bool is_1_2_1 = ky[0] == 1 && ky[1] == 2;
|
||||
@@ -3021,7 +3021,7 @@ void preprocess2DKernel( const Mat& kernel, std::vector<Point>& coords, std::vec
|
||||
|
||||
for( i = k = 0; i < kernel.rows; i++ )
|
||||
{
|
||||
const uchar* krow = kernel.data + kernel.step*i;
|
||||
const uchar* krow = kernel.ptr(i);
|
||||
for( j = 0; j < kernel.cols; j++ )
|
||||
{
|
||||
if( ktype == CV_8U )
|
||||
|
@@ -131,7 +131,7 @@ floodFill_CnIR( Mat& image, Point seed,
|
||||
_Tp newVal, ConnectedComp* region, int flags,
|
||||
std::vector<FFillSegment>* buffer )
|
||||
{
|
||||
_Tp* img = (_Tp*)(image.data + image.step * seed.y);
|
||||
_Tp* img = image.ptr<_Tp>(seed.y);
|
||||
Size roi = image.size();
|
||||
int i, L, R;
|
||||
int area = 0;
|
||||
@@ -180,7 +180,7 @@ floodFill_CnIR( Mat& image, Point seed,
|
||||
for( k = 0; k < 3; k++ )
|
||||
{
|
||||
dir = data[k][0];
|
||||
img = (_Tp*)(image.data + (YC + dir) * image.step);
|
||||
img = image.ptr<_Tp>(YC + dir);
|
||||
int left = data[k][1];
|
||||
int right = data[k][2];
|
||||
|
||||
@@ -283,9 +283,9 @@ floodFillGrad_CnIR( Mat& image, Mat& msk,
|
||||
std::vector<FFillSegment>* buffer )
|
||||
{
|
||||
int step = (int)image.step, maskStep = (int)msk.step;
|
||||
uchar* pImage = image.data;
|
||||
uchar* pImage = image.ptr();
|
||||
_Tp* img = (_Tp*)(pImage + step*seed.y);
|
||||
uchar* pMask = msk.data + maskStep + sizeof(_MTp);
|
||||
uchar* pMask = msk.ptr() + maskStep + sizeof(_MTp);
|
||||
_MTp* mask = (_MTp*)(pMask + maskStep*seed.y);
|
||||
int i, L, R;
|
||||
int area = 0;
|
||||
@@ -508,7 +508,7 @@ int cv::floodFill( InputOutputArray _image, InputOutputArray _mask,
|
||||
if( is_simple )
|
||||
{
|
||||
size_t elem_size = img.elemSize();
|
||||
const uchar* seed_ptr = img.data + img.step*seedPoint.y + elem_size*seedPoint.x;
|
||||
const uchar* seed_ptr = img.ptr(seedPoint.y) + elem_size*seedPoint.x;
|
||||
|
||||
size_t k = 0;
|
||||
for(; k < elem_size; k++)
|
||||
@@ -549,8 +549,8 @@ int cv::floodFill( InputOutputArray _image, InputOutputArray _mask,
|
||||
CV_Assert( mask.type() == CV_8U );
|
||||
}
|
||||
|
||||
memset( mask.data, 1, mask.cols );
|
||||
memset( mask.data + mask.step*(mask.rows-1), 1, mask.cols );
|
||||
memset( mask.ptr(), 1, mask.cols );
|
||||
memset( mask.ptr(mask.rows-1), 1, mask.cols );
|
||||
|
||||
for( i = 1; i <= size.height; i++ )
|
||||
{
|
||||
|
@@ -107,7 +107,7 @@ double cv::pointPolygonTest( InputArray _contour, Point2f pt, bool measureDist )
|
||||
if( total == 0 )
|
||||
return measureDist ? -DBL_MAX : -1;
|
||||
|
||||
const Point* cnt = (const Point*)contour.data;
|
||||
const Point* cnt = contour.ptr<Point>();
|
||||
const Point2f* cntf = (const Point2f*)cnt;
|
||||
|
||||
if( !is_float && !measureDist && ip.x == pt.x && ip.y == pt.y )
|
||||
|
@@ -154,7 +154,7 @@ static void histPrepareImages( const Mat* images, int nimages, const int* channe
|
||||
deltas[i*2+1] = (int)(images[j].step/esz1 - imsize.width*deltas[i*2]);
|
||||
}
|
||||
|
||||
if( mask.data )
|
||||
if( !mask.empty() )
|
||||
{
|
||||
CV_Assert( mask.size() == imsize && mask.channels() == 1 );
|
||||
isContinuous = isContinuous && mask.isContinuous();
|
||||
@@ -753,7 +753,7 @@ calcHist_( std::vector<uchar*>& _ptrs, const std::vector<int>& _deltas,
|
||||
{
|
||||
T** ptrs = (T**)&_ptrs[0];
|
||||
const int* deltas = &_deltas[0];
|
||||
uchar* H = hist.data;
|
||||
uchar* H = hist.ptr();
|
||||
int i, x;
|
||||
const uchar* mask = _ptrs[dims];
|
||||
int mstep = _deltas[dims*2 + 1];
|
||||
@@ -988,7 +988,7 @@ calcHist_8u( std::vector<uchar*>& _ptrs, const std::vector<int>& _deltas,
|
||||
{
|
||||
uchar** ptrs = &_ptrs[0];
|
||||
const int* deltas = &_deltas[0];
|
||||
uchar* H = hist.data;
|
||||
uchar* H = hist.ptr();
|
||||
int x;
|
||||
const uchar* mask = _ptrs[dims];
|
||||
int mstep = _deltas[dims*2 + 1];
|
||||
@@ -1192,8 +1192,8 @@ public:
|
||||
Mat phist(hist->size(), hist->type(), Scalar::all(0));
|
||||
|
||||
IppStatus status = ippiHistogramEven_8u_C1R(
|
||||
src->data + src->step * range.start, (int)src->step, ippiSize(src->cols, range.end - range.start),
|
||||
(Ipp32s *)phist.data, (Ipp32s *)*levels, histSize, low, high);
|
||||
src->ptr(range.start), (int)src->step, ippiSize(src->cols, range.end - range.start),
|
||||
phist.ptr<Ipp32s>(), (Ipp32s *)*levels, histSize, low, high);
|
||||
|
||||
if (status < 0)
|
||||
{
|
||||
@@ -1227,7 +1227,7 @@ void cv::calcHist( const Mat* images, int nimages, const int* channels,
|
||||
|
||||
CV_Assert(dims > 0 && histSize);
|
||||
|
||||
uchar* histdata = _hist.getMat().data;
|
||||
const uchar* const histdata = _hist.getMat().ptr();
|
||||
_hist.create(dims, histSize, CV_32F);
|
||||
Mat hist = _hist.getMat(), ihist = hist;
|
||||
ihist.flags = (ihist.flags & ~CV_MAT_TYPE_MASK)|CV_32S;
|
||||
@@ -1269,7 +1269,7 @@ void cv::calcHist( const Mat* images, int nimages, const int* channels,
|
||||
std::vector<double> uniranges;
|
||||
Size imsize;
|
||||
|
||||
CV_Assert( !mask.data || mask.type() == CV_8UC1 );
|
||||
CV_Assert( mask.empty() || mask.type() == CV_8UC1 );
|
||||
histPrepareImages( images, nimages, channels, mask, dims, hist.size, ranges,
|
||||
uniform, ptrs, deltas, imsize, uniranges );
|
||||
const double* _uniranges = uniform ? &uniranges[0] : 0;
|
||||
@@ -1442,7 +1442,7 @@ static void calcHist( const Mat* images, int nimages, const int* channels,
|
||||
std::vector<double> uniranges;
|
||||
Size imsize;
|
||||
|
||||
CV_Assert( !mask.data || mask.type() == CV_8UC1 );
|
||||
CV_Assert( mask.empty() || mask.type() == CV_8UC1 );
|
||||
histPrepareImages( images, nimages, channels, mask, dims, hist.hdr->size, ranges,
|
||||
uniform, ptrs, deltas, imsize, uniranges );
|
||||
const double* _uniranges = uniform ? &uniranges[0] : 0;
|
||||
@@ -1586,7 +1586,7 @@ calcBackProj_( std::vector<uchar*>& _ptrs, const std::vector<int>& _deltas,
|
||||
{
|
||||
T** ptrs = (T**)&_ptrs[0];
|
||||
const int* deltas = &_deltas[0];
|
||||
uchar* H = hist.data;
|
||||
const uchar* H = hist.ptr();
|
||||
int i, x;
|
||||
BT* bproj = (BT*)_ptrs[dims];
|
||||
int bpstep = _deltas[dims*2 + 1];
|
||||
@@ -1614,7 +1614,7 @@ calcBackProj_( std::vector<uchar*>& _ptrs, const std::vector<int>& _deltas,
|
||||
for( x = 0; x < imsize.width; x++, p0 += d0 )
|
||||
{
|
||||
int idx = cvFloor(*p0*a + b);
|
||||
bproj[x] = (unsigned)idx < (unsigned)sz ? saturate_cast<BT>(((float*)H)[idx]*scale) : 0;
|
||||
bproj[x] = (unsigned)idx < (unsigned)sz ? saturate_cast<BT>(((const float*)H)[idx]*scale) : 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1637,7 +1637,7 @@ calcBackProj_( std::vector<uchar*>& _ptrs, const std::vector<int>& _deltas,
|
||||
int idx1 = cvFloor(*p1*a1 + b1);
|
||||
bproj[x] = (unsigned)idx0 < (unsigned)sz0 &&
|
||||
(unsigned)idx1 < (unsigned)sz1 ?
|
||||
saturate_cast<BT>(((float*)(H + hstep0*idx0))[idx1]*scale) : 0;
|
||||
saturate_cast<BT>(((const float*)(H + hstep0*idx0))[idx1]*scale) : 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1665,7 +1665,7 @@ calcBackProj_( std::vector<uchar*>& _ptrs, const std::vector<int>& _deltas,
|
||||
bproj[x] = (unsigned)idx0 < (unsigned)sz0 &&
|
||||
(unsigned)idx1 < (unsigned)sz1 &&
|
||||
(unsigned)idx2 < (unsigned)sz2 ?
|
||||
saturate_cast<BT>(((float*)(H + hstep0*idx0 + hstep1*idx1))[idx2]*scale) : 0;
|
||||
saturate_cast<BT>(((const float*)(H + hstep0*idx0 + hstep1*idx1))[idx2]*scale) : 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1675,7 +1675,7 @@ calcBackProj_( std::vector<uchar*>& _ptrs, const std::vector<int>& _deltas,
|
||||
{
|
||||
for( x = 0; x < imsize.width; x++ )
|
||||
{
|
||||
uchar* Hptr = H;
|
||||
const uchar* Hptr = H;
|
||||
for( i = 0; i < dims; i++ )
|
||||
{
|
||||
int idx = cvFloor(*ptrs[i]*uniranges[i*2] + uniranges[i*2+1]);
|
||||
@@ -1686,7 +1686,7 @@ calcBackProj_( std::vector<uchar*>& _ptrs, const std::vector<int>& _deltas,
|
||||
}
|
||||
|
||||
if( i == dims )
|
||||
bproj[x] = saturate_cast<BT>(*(float*)Hptr*scale);
|
||||
bproj[x] = saturate_cast<BT>(*(const float*)Hptr*scale);
|
||||
else
|
||||
{
|
||||
bproj[x] = 0;
|
||||
@@ -1710,7 +1710,7 @@ calcBackProj_( std::vector<uchar*>& _ptrs, const std::vector<int>& _deltas,
|
||||
{
|
||||
for( x = 0; x < imsize.width; x++ )
|
||||
{
|
||||
uchar* Hptr = H;
|
||||
const uchar* Hptr = H;
|
||||
for( i = 0; i < dims; i++ )
|
||||
{
|
||||
float v = (float)*ptrs[i];
|
||||
@@ -1728,7 +1728,7 @@ calcBackProj_( std::vector<uchar*>& _ptrs, const std::vector<int>& _deltas,
|
||||
}
|
||||
|
||||
if( i == dims )
|
||||
bproj[x] = saturate_cast<BT>(*(float*)Hptr*scale);
|
||||
bproj[x] = saturate_cast<BT>(*(const float*)Hptr*scale);
|
||||
else
|
||||
{
|
||||
bproj[x] = 0;
|
||||
@@ -1751,7 +1751,7 @@ calcBackProj_8u( std::vector<uchar*>& _ptrs, const std::vector<int>& _deltas,
|
||||
{
|
||||
uchar** ptrs = &_ptrs[0];
|
||||
const int* deltas = &_deltas[0];
|
||||
uchar* H = hist.data;
|
||||
const uchar* H = hist.ptr();
|
||||
int i, x;
|
||||
uchar* bproj = _ptrs[dims];
|
||||
int bpstep = _deltas[dims*2 + 1];
|
||||
@@ -1813,7 +1813,7 @@ calcBackProj_8u( std::vector<uchar*>& _ptrs, const std::vector<int>& _deltas,
|
||||
for( x = 0; x < imsize.width; x++, p0 += d0, p1 += d1 )
|
||||
{
|
||||
size_t idx = tab[*p0] + tab[*p1 + 256];
|
||||
bproj[x] = idx < OUT_OF_RANGE ? saturate_cast<uchar>(*(float*)(H + idx)*scale) : 0;
|
||||
bproj[x] = idx < OUT_OF_RANGE ? saturate_cast<uchar>(*(const float*)(H + idx)*scale) : 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1831,7 +1831,7 @@ calcBackProj_8u( std::vector<uchar*>& _ptrs, const std::vector<int>& _deltas,
|
||||
for( x = 0; x < imsize.width; x++, p0 += d0, p1 += d1, p2 += d2 )
|
||||
{
|
||||
size_t idx = tab[*p0] + tab[*p1 + 256] + tab[*p2 + 512];
|
||||
bproj[x] = idx < OUT_OF_RANGE ? saturate_cast<uchar>(*(float*)(H + idx)*scale) : 0;
|
||||
bproj[x] = idx < OUT_OF_RANGE ? saturate_cast<uchar>(*(const float*)(H + idx)*scale) : 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1841,7 +1841,7 @@ calcBackProj_8u( std::vector<uchar*>& _ptrs, const std::vector<int>& _deltas,
|
||||
{
|
||||
for( x = 0; x < imsize.width; x++ )
|
||||
{
|
||||
uchar* Hptr = H;
|
||||
const uchar* Hptr = H;
|
||||
for( i = 0; i < dims; i++ )
|
||||
{
|
||||
size_t idx = tab[*ptrs[i] + i*256];
|
||||
@@ -1852,7 +1852,7 @@ calcBackProj_8u( std::vector<uchar*>& _ptrs, const std::vector<int>& _deltas,
|
||||
}
|
||||
|
||||
if( i == dims )
|
||||
bproj[x] = saturate_cast<uchar>(*(float*)Hptr*scale);
|
||||
bproj[x] = saturate_cast<uchar>(*(const float*)Hptr*scale);
|
||||
else
|
||||
{
|
||||
bproj[x] = 0;
|
||||
@@ -1879,7 +1879,7 @@ void cv::calcBackProject( const Mat* images, int nimages, const int* channels,
|
||||
Size imsize;
|
||||
int dims = hist.dims == 2 && hist.size[1] == 1 ? 1 : hist.dims;
|
||||
|
||||
CV_Assert( dims > 0 && hist.data );
|
||||
CV_Assert( dims > 0 && !hist.empty() );
|
||||
_backProject.create( images[0].size(), images[0].depth() );
|
||||
Mat backProject = _backProject.getMat();
|
||||
histPrepareImages( images, nimages, channels, backProject, dims, hist.size, ranges,
|
||||
@@ -2233,7 +2233,7 @@ void cv::calcBackProject( InputArrayOfArrays images, const std::vector<int>& cha
|
||||
int hsz[CV_CN_MAX+1];
|
||||
memcpy(hsz, &H0.size[0], H0.dims*sizeof(hsz[0]));
|
||||
hsz[H0.dims] = hcn;
|
||||
H = Mat(H0.dims+1, hsz, H0.depth(), H0.data);
|
||||
H = Mat(H0.dims+1, hsz, H0.depth(), H0.ptr());
|
||||
}
|
||||
else
|
||||
H = H0;
|
||||
@@ -2281,8 +2281,8 @@ double cv::compareHist( InputArray _H1, InputArray _H2, int method )
|
||||
|
||||
for( size_t i = 0; i < it.nplanes; i++, ++it )
|
||||
{
|
||||
const float* h1 = (const float*)it.planes[0].data;
|
||||
const float* h2 = (const float*)it.planes[1].data;
|
||||
const float* h1 = it.planes[0].ptr<float>();
|
||||
const float* h2 = it.planes[1].ptr<float>();
|
||||
len = it.planes[0].rows*it.planes[0].cols*H1.channels();
|
||||
|
||||
if( (method == CV_COMP_CHISQR) || (method == CV_COMP_CHISQR_ALT))
|
||||
|
@@ -84,7 +84,7 @@ HoughLinesStandard( const Mat& img, float rho, float theta,
|
||||
|
||||
CV_Assert( img.type() == CV_8UC1 );
|
||||
|
||||
const uchar* image = img.data;
|
||||
const uchar* image = img.ptr();
|
||||
int step = (int)img.step;
|
||||
int width = img.cols;
|
||||
int height = img.rows;
|
||||
@@ -224,7 +224,7 @@ HoughLinesSDiv( const Mat& img,
|
||||
|
||||
threshold = MIN( threshold, 255 );
|
||||
|
||||
const uchar* image_src = img.data;
|
||||
const uchar* image_src = img.ptr();
|
||||
int step = (int)img.step;
|
||||
int w = img.cols;
|
||||
int h = img.rows;
|
||||
@@ -462,7 +462,7 @@ HoughLinesProbabilistic( Mat& image,
|
||||
trigtab[n*2+1] = (float)(sin((double)n*theta) * irho);
|
||||
}
|
||||
const float* ttab = &trigtab[0];
|
||||
uchar* mdata0 = mask.data;
|
||||
uchar* mdata0 = mask.ptr();
|
||||
std::vector<Point> nzloc;
|
||||
|
||||
// stage 1. collect non-zero image points
|
||||
@@ -493,7 +493,7 @@ HoughLinesProbabilistic( Mat& image,
|
||||
Point point = nzloc[idx];
|
||||
Point line_end[2];
|
||||
float a, b;
|
||||
int* adata = (int*)accum.data;
|
||||
int* adata = accum.ptr<int>();
|
||||
int i = point.y, j = point.x, k, x0, y0, dx0, dy0, xflag;
|
||||
int good_line;
|
||||
const int shift = 16;
|
||||
@@ -626,7 +626,7 @@ HoughLinesProbabilistic( Mat& image,
|
||||
{
|
||||
if( good_line )
|
||||
{
|
||||
adata = (int*)accum.data;
|
||||
adata = accum.ptr<int>();
|
||||
for( int n = 0; n < numangle; n++, adata += numrho )
|
||||
{
|
||||
int r = cvRound( j1 * ttab[n*2] + i1 * ttab[n*2+1] );
|
||||
@@ -787,7 +787,7 @@ cvHoughLines2( CvArr* src_image, void* lineStorage, int method,
|
||||
}
|
||||
else
|
||||
{
|
||||
cvSeqPushMulti(lines, lx.data, nlines);
|
||||
cvSeqPushMulti(lines, lx.ptr(), nlines);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1104,7 +1104,7 @@ static void seqToMat(const CvSeq* seq, OutputArray _arr)
|
||||
{
|
||||
_arr.create(1, seq->total, seq->flags, -1, true);
|
||||
Mat arr = _arr.getMat();
|
||||
cvCvtSeqToArray(seq, arr.data);
|
||||
cvCvtSeqToArray(seq, arr.ptr());
|
||||
}
|
||||
else
|
||||
_arr.release();
|
||||
|
@@ -341,7 +341,7 @@ public:
|
||||
{
|
||||
uchar* D = dst.data + dst.step*y;
|
||||
int sy = std::min(cvFloor(y*ify), ssize.height-1);
|
||||
const uchar* S = src.data + src.step*sy;
|
||||
const uchar* S = src.ptr(sy);
|
||||
|
||||
switch( pix_size )
|
||||
{
|
||||
@@ -1265,7 +1265,7 @@ public:
|
||||
}
|
||||
if( k1 == ksize )
|
||||
k0 = std::min(k0, k); // remember the first row that needs to be computed
|
||||
srows[k] = (T*)(src.data + src.step*sy);
|
||||
srows[k] = src.ptr<T>(sy);
|
||||
prev_sy[k] = sy;
|
||||
}
|
||||
|
||||
@@ -1608,10 +1608,10 @@ public:
|
||||
continue;
|
||||
}
|
||||
|
||||
dx = vop((const T*)(src.data + src.step * sy0), D, w);
|
||||
dx = vop(src.ptr<T>(sy0), D, w);
|
||||
for( ; dx < w; dx++ )
|
||||
{
|
||||
const T* S = (const T*)(src.data + src.step * sy0) + xofs[dx];
|
||||
const T* S = src.ptr<T>(sy0) + xofs[dx];
|
||||
WT sum = 0;
|
||||
k = 0;
|
||||
#if CV_ENABLE_UNROLLED
|
||||
@@ -1635,7 +1635,7 @@ public:
|
||||
{
|
||||
if( sy0 + sy >= ssize.height )
|
||||
break;
|
||||
const T* S = (const T*)(src.data + src.step*(sy0 + sy)) + sx0;
|
||||
const T* S = src.ptr<T>(sy0 + sy) + sx0;
|
||||
for( int sx = 0; sx < scale_x*cn; sx += cn )
|
||||
{
|
||||
if( sx0 + sx >= ssize.width )
|
||||
@@ -1713,7 +1713,7 @@ public:
|
||||
int sy = ytab[j].si;
|
||||
|
||||
{
|
||||
const T* S = (const T*)(src->data + src->step*sy);
|
||||
const T* S = src->ptr<T>(sy);
|
||||
for( dx = 0; dx < dsize.width; dx++ )
|
||||
buf[dx] = (WT)0;
|
||||
|
||||
@@ -1775,7 +1775,7 @@ public:
|
||||
|
||||
if( dy != prev_dy )
|
||||
{
|
||||
T* D = (T*)(dst->data + dst->step*prev_dy);
|
||||
T* D = dst->ptr<T>(prev_dy);
|
||||
|
||||
for( dx = 0; dx < dsize.width; dx++ )
|
||||
{
|
||||
@@ -1792,7 +1792,7 @@ public:
|
||||
}
|
||||
|
||||
{
|
||||
T* D = (T*)(dst->data + dst->step*prev_dy);
|
||||
T* D = dst->ptr<T>(prev_dy);
|
||||
for( dx = 0; dx < dsize.width; dx++ )
|
||||
D[dx] = saturate_cast<T>(sum[dx]);
|
||||
}
|
||||
@@ -1973,8 +1973,8 @@ public:
|
||||
CHECK_IPP_STATUS(getBufferSizeFunc(pSpec, dstSize, cn, &bufsize));
|
||||
CHECK_IPP_STATUS(getSrcOffsetFunc(pSpec, dstOffset, &srcOffset));
|
||||
|
||||
const Ipp8u* pSrc = (const Ipp8u*)src.data + (int)src.step[0] * srcOffset.y + srcOffset.x * cn * itemSize;
|
||||
Ipp8u* pDst = (Ipp8u*)dst.data + (int)dst.step[0] * dstOffset.y + dstOffset.x * cn * itemSize;
|
||||
const Ipp8u* pSrc = src.ptr<Ipp8u>(srcOffset.y) + srcOffset.x * cn * itemSize;
|
||||
Ipp8u* pDst = dst.ptr<Ipp8u>(dstOffset.y) + dstOffset.x * cn * itemSize;
|
||||
|
||||
AutoBuffer<uchar> buf(bufsize + 64);
|
||||
uchar* bufptr = alignPtr((uchar*)buf, 32);
|
||||
@@ -2643,7 +2643,7 @@ static void remapNearest( const Mat& _src, Mat& _dst, const Mat& _xy,
|
||||
{
|
||||
Size ssize = _src.size(), dsize = _dst.size();
|
||||
int cn = _src.channels();
|
||||
const T* S0 = (const T*)_src.data;
|
||||
const T* S0 = _src.ptr<T>();
|
||||
size_t sstep = _src.step/sizeof(S0[0]);
|
||||
Scalar_<T> cval(saturate_cast<T>(_borderValue[0]),
|
||||
saturate_cast<T>(_borderValue[1]),
|
||||
@@ -2661,8 +2661,8 @@ static void remapNearest( const Mat& _src, Mat& _dst, const Mat& _xy,
|
||||
|
||||
for( dy = 0; dy < dsize.height; dy++ )
|
||||
{
|
||||
T* D = (T*)(_dst.data + _dst.step*dy);
|
||||
const short* XY = (const short*)(_xy.data + _xy.step*dy);
|
||||
T* D = _dst.ptr<T>(dy);
|
||||
const short* XY = _xy.ptr<short>(dy);
|
||||
|
||||
if( cn == 1 )
|
||||
{
|
||||
@@ -2759,7 +2759,7 @@ struct RemapVec_8u
|
||||
sstep > 0x8000 )
|
||||
return 0;
|
||||
|
||||
const uchar *S0 = _src.data, *S1 = _src.data + _src.step;
|
||||
const uchar *S0 = _src.ptr(), *S1 = _src.ptr(1);
|
||||
const short* wtab = cn == 1 ? (const short*)_wtab : &BilinearTab_iC4[0][0][0];
|
||||
uchar* D = (uchar*)_dst;
|
||||
__m128i delta = _mm_set1_epi32(INTER_REMAP_COEF_SCALE/2);
|
||||
@@ -2963,7 +2963,7 @@ static void remapBilinear( const Mat& _src, Mat& _dst, const Mat& _xy,
|
||||
Size ssize = _src.size(), dsize = _dst.size();
|
||||
int cn = _src.channels();
|
||||
const AT* wtab = (const AT*)_wtab;
|
||||
const T* S0 = (const T*)_src.data;
|
||||
const T* S0 = _src.ptr<T>();
|
||||
size_t sstep = _src.step/sizeof(S0[0]);
|
||||
Scalar_<T> cval(saturate_cast<T>(_borderValue[0]),
|
||||
saturate_cast<T>(_borderValue[1]),
|
||||
@@ -2982,9 +2982,9 @@ static void remapBilinear( const Mat& _src, Mat& _dst, const Mat& _xy,
|
||||
|
||||
for( dy = 0; dy < dsize.height; dy++ )
|
||||
{
|
||||
T* D = (T*)(_dst.data + _dst.step*dy);
|
||||
const short* XY = (const short*)(_xy.data + _xy.step*dy);
|
||||
const ushort* FXY = (const ushort*)(_fxy.data + _fxy.step*dy);
|
||||
T* D = _dst.ptr<T>(dy);
|
||||
const short* XY = _xy.ptr<short>(dy);
|
||||
const ushort* FXY = _fxy.ptr<ushort>(dy);
|
||||
int X0 = 0;
|
||||
bool prevInlier = false;
|
||||
|
||||
@@ -3163,7 +3163,7 @@ static void remapBicubic( const Mat& _src, Mat& _dst, const Mat& _xy,
|
||||
Size ssize = _src.size(), dsize = _dst.size();
|
||||
int cn = _src.channels();
|
||||
const AT* wtab = (const AT*)_wtab;
|
||||
const T* S0 = (const T*)_src.data;
|
||||
const T* S0 = _src.ptr<T>();
|
||||
size_t sstep = _src.step/sizeof(S0[0]);
|
||||
Scalar_<T> cval(saturate_cast<T>(_borderValue[0]),
|
||||
saturate_cast<T>(_borderValue[1]),
|
||||
@@ -3183,9 +3183,9 @@ static void remapBicubic( const Mat& _src, Mat& _dst, const Mat& _xy,
|
||||
|
||||
for( dy = 0; dy < dsize.height; dy++ )
|
||||
{
|
||||
T* D = (T*)(_dst.data + _dst.step*dy);
|
||||
const short* XY = (const short*)(_xy.data + _xy.step*dy);
|
||||
const ushort* FXY = (const ushort*)(_fxy.data + _fxy.step*dy);
|
||||
T* D = _dst.ptr<T>(dy);
|
||||
const short* XY = _xy.ptr<short>(dy);
|
||||
const ushort* FXY = _fxy.ptr<ushort>(dy);
|
||||
|
||||
for( dx = 0; dx < dsize.width; dx++, D += cn )
|
||||
{
|
||||
@@ -3268,7 +3268,7 @@ static void remapLanczos4( const Mat& _src, Mat& _dst, const Mat& _xy,
|
||||
Size ssize = _src.size(), dsize = _dst.size();
|
||||
int cn = _src.channels();
|
||||
const AT* wtab = (const AT*)_wtab;
|
||||
const T* S0 = (const T*)_src.data;
|
||||
const T* S0 = _src.ptr<T>();
|
||||
size_t sstep = _src.step/sizeof(S0[0]);
|
||||
Scalar_<T> cval(saturate_cast<T>(_borderValue[0]),
|
||||
saturate_cast<T>(_borderValue[1]),
|
||||
@@ -3288,9 +3288,9 @@ static void remapLanczos4( const Mat& _src, Mat& _dst, const Mat& _xy,
|
||||
|
||||
for( dy = 0; dy < dsize.height; dy++ )
|
||||
{
|
||||
T* D = (T*)(_dst.data + _dst.step*dy);
|
||||
const short* XY = (const short*)(_xy.data + _xy.step*dy);
|
||||
const ushort* FXY = (const ushort*)(_fxy.data + _fxy.step*dy);
|
||||
T* D = _dst.ptr<T>(dy);
|
||||
const short* XY = _xy.ptr<short>(dy);
|
||||
const ushort* FXY = _fxy.ptr<ushort>(dy);
|
||||
|
||||
for( dx = 0; dx < dsize.width; dx++, D += cn )
|
||||
{
|
||||
@@ -3415,15 +3415,15 @@ public:
|
||||
|
||||
if( nnfunc )
|
||||
{
|
||||
if( m1->type() == CV_16SC2 && !m2->data ) // the data is already in the right format
|
||||
if( m1->type() == CV_16SC2 && m2->empty() ) // the data is already in the right format
|
||||
bufxy = (*m1)(Rect(x, y, bcols, brows));
|
||||
else if( map_depth != CV_32F )
|
||||
{
|
||||
for( y1 = 0; y1 < brows; y1++ )
|
||||
{
|
||||
short* XY = (short*)(bufxy.data + bufxy.step*y1);
|
||||
const short* sXY = (const short*)(m1->data + m1->step*(y+y1)) + x*2;
|
||||
const ushort* sA = (const ushort*)(m2->data + m2->step*(y+y1)) + x;
|
||||
short* XY = bufxy.ptr<short>(y1);
|
||||
const short* sXY = m1->ptr<short>(y+y1) + x*2;
|
||||
const ushort* sA = m2->ptr<ushort>(y+y1) + x;
|
||||
|
||||
for( x1 = 0; x1 < bcols; x1++ )
|
||||
{
|
||||
@@ -3439,9 +3439,9 @@ public:
|
||||
{
|
||||
for( y1 = 0; y1 < brows; y1++ )
|
||||
{
|
||||
short* XY = (short*)(bufxy.data + bufxy.step*y1);
|
||||
const float* sX = (const float*)(m1->data + m1->step*(y+y1)) + x;
|
||||
const float* sY = (const float*)(m2->data + m2->step*(y+y1)) + x;
|
||||
short* XY = bufxy.ptr<short>(y1);
|
||||
const float* sX = m1->ptr<float>(y+y1) + x;
|
||||
const float* sY = m2->ptr<float>(y+y1) + x;
|
||||
x1 = 0;
|
||||
|
||||
#if CV_SSE2
|
||||
@@ -3481,21 +3481,21 @@ public:
|
||||
Mat bufa(_bufa, Rect(0, 0, bcols, brows));
|
||||
for( y1 = 0; y1 < brows; y1++ )
|
||||
{
|
||||
short* XY = (short*)(bufxy.data + bufxy.step*y1);
|
||||
ushort* A = (ushort*)(bufa.data + bufa.step*y1);
|
||||
short* XY = bufxy.ptr<short>(y1);
|
||||
ushort* A = bufa.ptr<ushort>(y1);
|
||||
|
||||
if( m1->type() == CV_16SC2 && (m2->type() == CV_16UC1 || m2->type() == CV_16SC1) )
|
||||
{
|
||||
bufxy = (*m1)(Rect(x, y, bcols, brows));
|
||||
|
||||
const ushort* sA = (const ushort*)(m2->data + m2->step*(y+y1)) + x;
|
||||
const ushort* sA = m2->ptr<ushort>(y+y1) + x;
|
||||
for( x1 = 0; x1 < bcols; x1++ )
|
||||
A[x1] = (ushort)(sA[x1] & (INTER_TAB_SIZE2-1));
|
||||
}
|
||||
else if( planar_input )
|
||||
{
|
||||
const float* sX = (const float*)(m1->data + m1->step*(y+y1)) + x;
|
||||
const float* sY = (const float*)(m2->data + m2->step*(y+y1)) + x;
|
||||
const float* sX = m1->ptr<float>(y+y1) + x;
|
||||
const float* sY = m2->ptr<float>(y+y1) + x;
|
||||
|
||||
x1 = 0;
|
||||
#if CV_SSE2
|
||||
@@ -3548,7 +3548,7 @@ public:
|
||||
}
|
||||
else
|
||||
{
|
||||
const float* sXY = (const float*)(m1->data + m1->step*(y+y1)) + x*2;
|
||||
const float* sXY = m1->ptr<float>(y+y1) + x*2;
|
||||
|
||||
for( x1 = 0; x1 < bcols; x1++ )
|
||||
{
|
||||
@@ -3650,7 +3650,7 @@ static bool ocl_remap(InputArray _src, OutputArray _dst, InputArray _map1, Input
|
||||
Mat scalar(1, 1, sctype, borderValue);
|
||||
ocl::KernelArg srcarg = ocl::KernelArg::ReadOnly(src), dstarg = ocl::KernelArg::WriteOnly(dst),
|
||||
map1arg = ocl::KernelArg::ReadOnlyNoSize(map1),
|
||||
scalararg = ocl::KernelArg::Constant((void*)scalar.data, scalar.elemSize());
|
||||
scalararg = ocl::KernelArg::Constant((void*)scalar.ptr(), scalar.elemSize());
|
||||
|
||||
if (map2.empty())
|
||||
k.args(srcarg, dstarg, map1arg, scalararg);
|
||||
@@ -3689,15 +3689,15 @@ public:
|
||||
int type = dst.type(), depth = CV_MAT_DEPTH(type), cn = CV_MAT_CN(type);
|
||||
|
||||
if (borderType == BORDER_CONSTANT &&
|
||||
!IPPSet(borderValue, dstRoi.data, (int)dstRoi.step, dstRoiSize, cn, depth))
|
||||
!IPPSet(borderValue, dstRoi.ptr(), (int)dstRoi.step, dstRoiSize, cn, depth))
|
||||
{
|
||||
*ok = false;
|
||||
return;
|
||||
}
|
||||
|
||||
if (ippFunc(src.data, ippiSize(src.size()), (int)src.step, srcRoiRect,
|
||||
(const Ipp32f *)map1.data, (int)map1.step, (const Ipp32f *)map2.data, (int)map2.step,
|
||||
dstRoi.data, (int)dstRoi.step, dstRoiSize, ippInterpolation) < 0)
|
||||
if (ippFunc(src.ptr(), ippiSize(src.size()), (int)src.step, srcRoiRect,
|
||||
map1.ptr<Ipp32f>(), (int)map1.step, map2.ptr<Ipp32f>(), (int)map2.step,
|
||||
dstRoi.ptr(), (int)dstRoi.step, dstRoiSize, ippInterpolation) < 0)
|
||||
*ok = false;
|
||||
}
|
||||
|
||||
@@ -3829,15 +3829,15 @@ void cv::remap( InputArray _src, OutputArray _dst,
|
||||
|
||||
const Mat *m1 = &map1, *m2 = &map2;
|
||||
|
||||
if( (map1.type() == CV_16SC2 && (map2.type() == CV_16UC1 || map2.type() == CV_16SC1 || !map2.data)) ||
|
||||
(map2.type() == CV_16SC2 && (map1.type() == CV_16UC1 || map1.type() == CV_16SC1 || !map1.data)) )
|
||||
if( (map1.type() == CV_16SC2 && (map2.type() == CV_16UC1 || map2.type() == CV_16SC1 || map2.empty())) ||
|
||||
(map2.type() == CV_16SC2 && (map1.type() == CV_16UC1 || map1.type() == CV_16SC1 || map1.empty())) )
|
||||
{
|
||||
if( map1.type() != CV_16SC2 )
|
||||
std::swap(m1, m2);
|
||||
}
|
||||
else
|
||||
{
|
||||
CV_Assert( ((map1.type() == CV_32FC2 || map1.type() == CV_16SC2) && !map2.data) ||
|
||||
CV_Assert( ((map1.type() == CV_32FC2 || map1.type() == CV_16SC2) && map2.empty()) ||
|
||||
(map1.type() == CV_32FC1 && map2.type() == CV_32FC1) );
|
||||
planar_input = map1.channels() == 1;
|
||||
}
|
||||
@@ -3861,7 +3861,7 @@ void cv::convertMaps( InputArray _map1, InputArray _map2,
|
||||
CV_Assert( (m1type == CV_16SC2 && (nninterpolate || m2type == CV_16UC1 || m2type == CV_16SC1)) ||
|
||||
(m2type == CV_16SC2 && (nninterpolate || m1type == CV_16UC1 || m1type == CV_16SC1)) ||
|
||||
(m1type == CV_32FC1 && m2type == CV_32FC1) ||
|
||||
(m1type == CV_32FC2 && !m2->data) );
|
||||
(m1type == CV_32FC2 && m2->empty()) );
|
||||
|
||||
if( m2type == CV_16SC2 )
|
||||
{
|
||||
@@ -3888,7 +3888,7 @@ void cv::convertMaps( InputArray _map1, InputArray _map2,
|
||||
(m1type == CV_32FC2 && dstm1type == CV_16SC2))) )
|
||||
{
|
||||
m1->convertTo( dstmap1, dstmap1.type() );
|
||||
if( dstmap2.data && dstmap2.type() == m2->type() )
|
||||
if( !dstmap2.empty() && dstmap2.type() == m2->type() )
|
||||
m2->copyTo( dstmap2 );
|
||||
return;
|
||||
}
|
||||
@@ -3907,8 +3907,8 @@ void cv::convertMaps( InputArray _map1, InputArray _map2,
|
||||
return;
|
||||
}
|
||||
|
||||
if( m1->isContinuous() && (!m2->data || m2->isContinuous()) &&
|
||||
dstmap1.isContinuous() && (!dstmap2.data || dstmap2.isContinuous()) )
|
||||
if( m1->isContinuous() && (m2->empty() || m2->isContinuous()) &&
|
||||
dstmap1.isContinuous() && (dstmap2.empty() || dstmap2.isContinuous()) )
|
||||
{
|
||||
size.width *= size.height;
|
||||
size.height = 1;
|
||||
@@ -3918,13 +3918,13 @@ void cv::convertMaps( InputArray _map1, InputArray _map2,
|
||||
int x, y;
|
||||
for( y = 0; y < size.height; y++ )
|
||||
{
|
||||
const float* src1f = (const float*)(m1->data + m1->step*y);
|
||||
const float* src2f = (const float*)(m2->data + m2->step*y);
|
||||
const float* src1f = m1->ptr<float>(y);
|
||||
const float* src2f = m2->ptr<float>(y);
|
||||
const short* src1 = (const short*)src1f;
|
||||
const ushort* src2 = (const ushort*)src2f;
|
||||
|
||||
float* dst1f = (float*)(dstmap1.data + dstmap1.step*y);
|
||||
float* dst2f = (float*)(dstmap2.data + dstmap2.step*y);
|
||||
float* dst1f = dstmap1.ptr<float>(y);
|
||||
float* dst2f = dstmap2.ptr<float>(y);
|
||||
short* dst1 = (short*)dst1f;
|
||||
ushort* dst2 = (ushort*)dst2f;
|
||||
|
||||
@@ -4135,7 +4135,7 @@ public:
|
||||
if( borderType == BORDER_CONSTANT )
|
||||
{
|
||||
IppiSize setSize = { dst.cols, range.end - range.start };
|
||||
void *dataPointer = dst.data + dst.step[0] * range.start;
|
||||
void *dataPointer = dst.ptr(range.start);
|
||||
if( !IPPSet( borderValue, dataPointer, (int)dst.step[0], setSize, cnn, src.depth() ) )
|
||||
{
|
||||
*ok = false;
|
||||
@@ -4144,7 +4144,7 @@ public:
|
||||
}
|
||||
|
||||
// Aug 2013: problem in IPP 7.1, 8.0 : sometimes function return ippStsCoeffErr
|
||||
IppStatus status = func( src.data, srcsize, (int)src.step[0], srcroi, dst.data,
|
||||
IppStatus status = func( src.ptr(), srcsize, (int)src.step[0], srcroi, dst.ptr(),
|
||||
(int)dst.step[0], dstroi, coeffs, mode );
|
||||
if( status < 0)
|
||||
*ok = false;
|
||||
@@ -4502,7 +4502,7 @@ public:
|
||||
if( borderType == BORDER_CONSTANT )
|
||||
{
|
||||
IppiSize setSize = {dst.cols, range.end - range.start};
|
||||
void *dataPointer = dst.data + dst.step[0] * range.start;
|
||||
void *dataPointer = dst.ptr(range.start);
|
||||
if( !IPPSet( borderValue, dataPointer, (int)dst.step[0], setSize, cnn, src.depth() ) )
|
||||
{
|
||||
*ok = false;
|
||||
@@ -4510,7 +4510,7 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
IppStatus status = func(src.data, srcsize, (int)src.step[0], srcroi, dst.data, (int)dst.step[0], dstroi, coeffs, mode);
|
||||
IppStatus status = func(src.ptr(), srcsize, (int)src.step[0], srcroi, dst.ptr(), (int)dst.step[0], dstroi, coeffs, mode);
|
||||
if (status != ippStsNoErr)
|
||||
*ok = false;
|
||||
}
|
||||
@@ -4629,7 +4629,7 @@ cv::Mat cv::getRotationMatrix2D( Point2f center, double angle, double scale )
|
||||
double beta = sin(angle)*scale;
|
||||
|
||||
Mat M(2, 3, CV_64F);
|
||||
double* m = (double*)M.data;
|
||||
double* m = M.ptr<double>();
|
||||
|
||||
m[0] = alpha;
|
||||
m[1] = beta;
|
||||
@@ -4667,7 +4667,7 @@ cv::Mat cv::getRotationMatrix2D( Point2f center, double angle, double scale )
|
||||
*/
|
||||
cv::Mat cv::getPerspectiveTransform( const Point2f src[], const Point2f dst[] )
|
||||
{
|
||||
Mat M(3, 3, CV_64F), X(8, 1, CV_64F, M.data);
|
||||
Mat M(3, 3, CV_64F), X(8, 1, CV_64F, M.ptr());
|
||||
double a[8][8], b[8];
|
||||
Mat A(8, 8, CV_64F, a), B(8, 1, CV_64F, b);
|
||||
|
||||
@@ -4687,7 +4687,7 @@ cv::Mat cv::getPerspectiveTransform( const Point2f src[], const Point2f dst[] )
|
||||
}
|
||||
|
||||
solve( A, B, X, DECOMP_SVD );
|
||||
((double*)M.data)[8] = 1.;
|
||||
M.ptr<double>()[8] = 1.;
|
||||
|
||||
return M;
|
||||
}
|
||||
@@ -4713,7 +4713,7 @@ cv::Mat cv::getPerspectiveTransform( const Point2f src[], const Point2f dst[] )
|
||||
|
||||
cv::Mat cv::getAffineTransform( const Point2f src[], const Point2f dst[] )
|
||||
{
|
||||
Mat M(2, 3, CV_64F), X(6, 1, CV_64F, M.data);
|
||||
Mat M(2, 3, CV_64F), X(6, 1, CV_64F, M.ptr());
|
||||
double a[6*6], b[6];
|
||||
Mat A(6, 6, CV_64F, a), B(6, 1, CV_64F, b);
|
||||
|
||||
@@ -4743,8 +4743,8 @@ void cv::invertAffineTransform(InputArray _matM, OutputArray __iM)
|
||||
|
||||
if( matM.type() == CV_32F )
|
||||
{
|
||||
const float* M = (const float*)matM.data;
|
||||
float* iM = (float*)_iM.data;
|
||||
const float* M = matM.ptr<float>();
|
||||
float* iM = _iM.ptr<float>();
|
||||
int step = (int)(matM.step/sizeof(M[0])), istep = (int)(_iM.step/sizeof(iM[0]));
|
||||
|
||||
double D = M[0]*M[step+1] - M[1]*M[step];
|
||||
@@ -4758,8 +4758,8 @@ void cv::invertAffineTransform(InputArray _matM, OutputArray __iM)
|
||||
}
|
||||
else if( matM.type() == CV_64F )
|
||||
{
|
||||
const double* M = (const double*)matM.data;
|
||||
double* iM = (double*)_iM.data;
|
||||
const double* M = matM.ptr<double>();
|
||||
double* iM = _iM.ptr<double>();
|
||||
int step = (int)(matM.step/sizeof(M[0])), istep = (int)(_iM.step/sizeof(iM[0]));
|
||||
|
||||
double D = M[0]*M[step+1] - M[1]*M[step];
|
||||
@@ -4887,7 +4887,7 @@ cvConvertMaps( const CvArr* arr1, const CvArr* arr2, CvArr* dstarr1, CvArr* dsta
|
||||
{
|
||||
dstmap2 = cv::cvarrToMat(dstarr2);
|
||||
if( dstmap2.type() == CV_16SC1 )
|
||||
dstmap2 = cv::Mat(dstmap2.size(), CV_16UC1, dstmap2.data, dstmap2.step);
|
||||
dstmap2 = cv::Mat(dstmap2.size(), CV_16UC1, dstmap2.ptr(), dstmap2.step);
|
||||
}
|
||||
|
||||
cv::convertMaps( map1, map2, dstmap1, dstmap2, dstmap1.type(), false );
|
||||
|
@@ -476,7 +476,7 @@ void LineSegmentDetectorImpl::flsd(std::vector<Vec4i>& lines,
|
||||
for(size_t i = 0, list_size = list.size(); i < list_size; ++i)
|
||||
{
|
||||
unsigned int adx = list[i].p.x + list[i].p.y * img_width;
|
||||
if((used.data[adx] == NOTUSED) && (angles_data[adx] != NOTDEF))
|
||||
if((used.ptr()[adx] == NOTUSED) && (angles_data[adx] != NOTDEF))
|
||||
{
|
||||
int reg_size;
|
||||
double reg_angle;
|
||||
@@ -640,7 +640,7 @@ void LineSegmentDetectorImpl::region_grow(const Point2i& s, std::vector<RegionPo
|
||||
reg[0].x = s.x;
|
||||
reg[0].y = s.y;
|
||||
int addr = s.x + s.y * img_width;
|
||||
reg[0].used = used.data + addr;
|
||||
reg[0].used = used.ptr() + addr;
|
||||
reg_angle = angles_data[addr];
|
||||
reg[0].angle = reg_angle;
|
||||
reg[0].modgrad = modgrad_data[addr];
|
||||
@@ -660,15 +660,15 @@ void LineSegmentDetectorImpl::region_grow(const Point2i& s, std::vector<RegionPo
|
||||
int c_addr = xx_min + yy * img_width;
|
||||
for(int xx = xx_min; xx <= xx_max; ++xx, ++c_addr)
|
||||
{
|
||||
if((used.data[c_addr] != USED) &&
|
||||
if((used.ptr()[c_addr] != USED) &&
|
||||
(isAligned(c_addr, reg_angle, prec)))
|
||||
{
|
||||
// Add point
|
||||
used.data[c_addr] = USED;
|
||||
used.ptr()[c_addr] = USED;
|
||||
RegionPoint& region_point = reg[reg_size];
|
||||
region_point.x = xx;
|
||||
region_point.y = yy;
|
||||
region_point.used = &(used.data[c_addr]);
|
||||
region_point.used = &(used.ptr()[c_addr]);
|
||||
region_point.modgrad = modgrad_data[c_addr];
|
||||
const double& angle = angles_data[c_addr];
|
||||
region_point.angle = angle;
|
||||
@@ -1232,16 +1232,16 @@ int LineSegmentDetectorImpl::compareSegments(const Size& size, InputArray lines1
|
||||
|
||||
for (unsigned int i = 0; i < I1.total(); ++i)
|
||||
{
|
||||
uchar i1 = I1.data[i];
|
||||
uchar i2 = I2.data[i];
|
||||
uchar i1 = I1.ptr()[i];
|
||||
uchar i2 = I2.ptr()[i];
|
||||
if (i1 || i2)
|
||||
{
|
||||
unsigned int base_idx = i * 3;
|
||||
if (i1) img.data[base_idx] = 255;
|
||||
else img.data[base_idx] = 0;
|
||||
img.data[base_idx + 1] = 0;
|
||||
if (i2) img.data[base_idx + 2] = 255;
|
||||
else img.data[base_idx + 2] = 0;
|
||||
if (i1) img.ptr()[base_idx] = 255;
|
||||
else img.ptr()[base_idx] = 0;
|
||||
img.ptr()[base_idx + 1] = 0;
|
||||
if (i2) img.ptr()[base_idx + 2] = 255;
|
||||
else img.ptr()[base_idx + 2] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -95,8 +95,8 @@ static Moments contourMoments( const Mat& contour )
|
||||
Moments m;
|
||||
int lpt = contour.checkVector(2);
|
||||
int is_float = contour.depth() == CV_32F;
|
||||
const Point* ptsi = (const Point*)contour.data;
|
||||
const Point2f* ptsf = (const Point2f*)contour.data;
|
||||
const Point* ptsi = contour.ptr<Point>();
|
||||
const Point2f* ptsf = contour.ptr<Point2f>();
|
||||
|
||||
CV_Assert( contour.depth() == CV_32S || contour.depth() == CV_32F );
|
||||
|
||||
@@ -338,7 +338,7 @@ static void momentsInTile( const Mat& img, double* moments )
|
||||
|
||||
for( y = 0; y < size.height; y++ )
|
||||
{
|
||||
const T* ptr = (const T*)(img.data + y*img.step);
|
||||
const T* ptr = img.ptr<T>(y);
|
||||
WT x0 = 0, x1 = 0, x2 = 0;
|
||||
MT x3 = 0;
|
||||
x = vop(ptr, size.width, x0, x1, x2, x3);
|
||||
@@ -690,7 +690,7 @@ void cv::HuMoments( const Moments& m, OutputArray _hu )
|
||||
_hu.create(7, 1, CV_64F);
|
||||
Mat hu = _hu.getMat();
|
||||
CV_Assert( hu.isContinuous() );
|
||||
HuMoments(m, (double*)hu.data);
|
||||
HuMoments(m, hu.ptr<double>());
|
||||
}
|
||||
|
||||
|
||||
|
@@ -1049,7 +1049,7 @@ cv::Mat cv::getStructuringElement(int shape, Size ksize, Point anchor)
|
||||
|
||||
for( i = 0; i < ksize.height; i++ )
|
||||
{
|
||||
uchar* ptr = elem.data + i*elem.step;
|
||||
uchar* ptr = elem.ptr(i);
|
||||
int j1 = 0, j2 = 0;
|
||||
|
||||
if( shape == MORPH_RECT || (shape == MORPH_CROSS && i == anchor.y) )
|
||||
@@ -1165,7 +1165,7 @@ static bool IPPMorphReplicate(int op, const Mat &src, Mat &dst, const Mat &kerne
|
||||
return false;\
|
||||
IppiMorphState *pSpec = (IppiMorphState*)ippMalloc(specSize);\
|
||||
Ipp8u *pBuffer = (Ipp8u*)ippMalloc(bufferSize);\
|
||||
if (0 > ippiMorphologyBorderInit_##flavor(roiSize.width, kernel.data, kernelSize, pSpec, pBuffer))\
|
||||
if (0 > ippiMorphologyBorderInit_##flavor(roiSize.width, kernel.ptr(), kernelSize, pSpec, pBuffer))\
|
||||
{\
|
||||
ippFree(pBuffer);\
|
||||
ippFree(pSpec);\
|
||||
@@ -1173,10 +1173,10 @@ static bool IPPMorphReplicate(int op, const Mat &src, Mat &dst, const Mat &kerne
|
||||
}\
|
||||
bool ok = false;\
|
||||
if (op == MORPH_ERODE)\
|
||||
ok = (0 <= ippiErodeBorder_##flavor((Ipp##data_type *)_src->data, (int)_src->step[0], (Ipp##data_type *)dst.data, (int)dst.step[0],\
|
||||
ok = (0 <= ippiErodeBorder_##flavor(_src->ptr<Ipp##data_type>(), (int)_src->step[0], dst.ptr<Ipp##data_type>(), (int)dst.step[0],\
|
||||
roiSize, ippBorderRepl, 0, pSpec, pBuffer));\
|
||||
else\
|
||||
ok = (0 <= ippiDilateBorder_##flavor((Ipp##data_type *)_src->data, (int)_src->step[0], (Ipp##data_type *)dst.data, (int)dst.step[0],\
|
||||
ok = (0 <= ippiDilateBorder_##flavor(_src->ptr<Ipp##data_type>(), (int)_src->step[0], dst.ptr<Ipp##data_type>(), (int)dst.step[0],\
|
||||
roiSize, ippBorderRepl, 0, pSpec, pBuffer));\
|
||||
ippFree(pBuffer);\
|
||||
ippFree(pSpec);\
|
||||
@@ -1192,19 +1192,19 @@ static bool IPPMorphReplicate(int op, const Mat &src, Mat &dst, const Mat &kerne
|
||||
{\
|
||||
int specSize = 0;\
|
||||
int bufferSize = 0;\
|
||||
if (0 > ippiMorphologyGetSize_##flavor( roiSize.width, kernel.data kernelSize, &specSize))\
|
||||
if (0 > ippiMorphologyGetSize_##flavor( roiSize.width, kernel.ptr() kernelSize, &specSize))\
|
||||
return false;\
|
||||
bool ok = false;\
|
||||
IppiMorphState* pState = (IppiMorphState*)ippMalloc(specSize);\
|
||||
if (ippiMorphologyInit_##flavor(roiSize.width, kernel.data, kernelSize, point, pState) >= 0)\
|
||||
if (ippiMorphologyInit_##flavor(roiSize.width, kernel.ptr(), kernelSize, point, pState) >= 0)\
|
||||
{\
|
||||
if (op == MORPH_ERODE)\
|
||||
ok = ippiErodeBorderReplicate_##flavor((Ipp##data_type *)_src->data, (int)_src->step[0],\
|
||||
(Ipp##data_type *)dst.data, (int)dst.step[0],\
|
||||
ok = ippiErodeBorderReplicate_##flavor(_src->ptr<Ipp##data_type>(), (int)_src->step[0],\
|
||||
dst.ptr<Ipp##data_type>(), (int)dst.step[0],\
|
||||
roiSize, ippBorderRepl, pState ) >= 0;\
|
||||
else\
|
||||
ok = ippiDilateBorderReplicate_##flavor((Ipp##data_type *)_src->data, (int)_src->step[0],\
|
||||
(Ipp##data_type *)dst.data, (int)dst.step[0],\
|
||||
ok = ippiDilateBorderReplicate_##flavor(_src->ptr<Ipp##data_type>(), (int)_src->step[0],\
|
||||
dst.ptr<Ipp##data_type>(), (int)dst.step[0],\
|
||||
roiSize, ippBorderRepl, pState ) >= 0;\
|
||||
}\
|
||||
ippFree(pState);\
|
||||
@@ -1239,8 +1239,8 @@ static bool IPPMorphReplicate(int op, const Mat &src, Mat &dst, const Mat &kerne
|
||||
AutoBuffer<uchar> buf(bufSize + 64);\
|
||||
uchar* buffer = alignPtr((uchar*)buf, 32);\
|
||||
if (op == MORPH_ERODE)\
|
||||
return (0 <= ippiFilterMinBorderReplicate_##flavor((Ipp##data_type *)_src->data, (int)_src->step[0], (Ipp##data_type *)dst.data, (int)dst.step[0], roiSize, kernelSize, point, buffer));\
|
||||
return (0 <= ippiFilterMaxBorderReplicate_##flavor((Ipp##data_type *)_src->data, (int)_src->step[0], (Ipp##data_type *)dst.data, (int)dst.step[0], roiSize, kernelSize, point, buffer));\
|
||||
return (0 <= ippiFilterMinBorderReplicate_##flavor(_src->ptr<Ipp##data_type>(), (int)_src->step[0], dst.ptr<Ipp##data_type>(), (int)dst.step[0], roiSize, kernelSize, point, buffer));\
|
||||
return (0 <= ippiFilterMaxBorderReplicate_##flavor(_src->ptr<Ipp##data_type>(), (int)_src->step[0], dst.ptr<Ipp##data_type>(), (int)dst.step[0], roiSize, kernelSize, point, buffer));\
|
||||
}\
|
||||
break;
|
||||
|
||||
@@ -1298,7 +1298,7 @@ static bool IPPMorphOp(int op, InputArray _src, OutputArray _dst,
|
||||
}
|
||||
|
||||
}
|
||||
Size ksize = kernel.data ? kernel.size() : Size(3,3);
|
||||
Size ksize = !kernel.empty() ? kernel.size() : Size(3,3);
|
||||
|
||||
_dst.create( src.size(), src.type() );
|
||||
Mat dst = _dst.getMat();
|
||||
@@ -1310,7 +1310,7 @@ static bool IPPMorphOp(int op, InputArray _src, OutputArray _dst,
|
||||
}
|
||||
|
||||
bool rectKernel = false;
|
||||
if( !kernel.data )
|
||||
if( kernel.empty() )
|
||||
{
|
||||
ksize = Size(1+iterations*2,1+iterations*2);
|
||||
anchor = Point(iterations, iterations);
|
||||
@@ -1502,7 +1502,7 @@ static bool ocl_morphOp(InputArray _src, OutputArray _dst, InputArray _kernel,
|
||||
int type = _src.type(), depth = CV_MAT_DEPTH(type),
|
||||
cn = CV_MAT_CN(type), esz = CV_ELEM_SIZE(type);
|
||||
Mat kernel = _kernel.getMat();
|
||||
Size ksize = kernel.data ? kernel.size() : Size(3, 3), ssize = _src.size();
|
||||
Size ksize = !kernel.empty() ? kernel.size() : Size(3, 3), ssize = _src.size();
|
||||
|
||||
bool doubleSupport = dev.doubleFPConfig() > 0;
|
||||
if ((depth == CV_64F && !doubleSupport) || borderType != BORDER_CONSTANT)
|
||||
@@ -1511,7 +1511,7 @@ static bool ocl_morphOp(InputArray _src, OutputArray _dst, InputArray _kernel,
|
||||
bool haveExtraMat = !_extraMat.empty();
|
||||
CV_Assert(actual_op <= 3 || haveExtraMat);
|
||||
|
||||
if (!kernel.data)
|
||||
if (kernel.empty())
|
||||
{
|
||||
kernel = getStructuringElement(MORPH_RECT, Size(1+iterations*2,1+iterations*2));
|
||||
anchor = Point(iterations, iterations);
|
||||
@@ -1665,7 +1665,7 @@ static void morphOp( int op, InputArray _src, OutputArray _dst,
|
||||
int borderType, const Scalar& borderValue )
|
||||
{
|
||||
Mat kernel = _kernel.getMat();
|
||||
Size ksize = kernel.data ? kernel.size() : Size(3,3);
|
||||
Size ksize = !kernel.empty() ? kernel.size() : Size(3,3);
|
||||
anchor = normalizeAnchor(anchor, ksize);
|
||||
|
||||
CV_OCL_RUN(_dst.isUMat() && _src.dims() <= 2 && _src.channels() <= 4 &&
|
||||
@@ -1680,7 +1680,7 @@ static void morphOp( int op, InputArray _src, OutputArray _dst,
|
||||
return;
|
||||
}
|
||||
|
||||
if (!kernel.data)
|
||||
if (kernel.empty())
|
||||
{
|
||||
kernel = getStructuringElement(MORPH_RECT, Size(1+iterations*2,1+iterations*2));
|
||||
anchor = Point(iterations, iterations);
|
||||
@@ -1886,7 +1886,7 @@ cvCreateStructuringElementEx( int cols, int rows,
|
||||
{
|
||||
cv::Mat elem = cv::getStructuringElement(shape, ksize, anchor);
|
||||
for( i = 0; i < size; i++ )
|
||||
element->values[i] = elem.data[i];
|
||||
element->values[i] = elem.ptr()[i];
|
||||
}
|
||||
|
||||
return element;
|
||||
@@ -1915,7 +1915,7 @@ static void convertConvKernel( const IplConvKernel* src, cv::Mat& dst, cv::Point
|
||||
|
||||
int i, size = src->nRows*src->nCols;
|
||||
for( i = 0; i < size; i++ )
|
||||
dst.data[i] = (uchar)(src->values[i] != 0);
|
||||
dst.ptr()[i] = (uchar)(src->values[i] != 0);
|
||||
}
|
||||
|
||||
|
||||
|
@@ -66,8 +66,8 @@ static void magSpectrums( InputArray _src, OutputArray _dst)
|
||||
|
||||
if( depth == CV_32F )
|
||||
{
|
||||
const float* dataSrc = (const float*)src.data;
|
||||
float* dataDst = (float*)dst.data;
|
||||
const float* dataSrc = src.ptr<float>();
|
||||
float* dataDst = dst.ptr<float>();
|
||||
|
||||
size_t stepSrc = src.step/sizeof(dataSrc[0]);
|
||||
size_t stepDst = dst.step/sizeof(dataDst[0]);
|
||||
@@ -110,8 +110,8 @@ static void magSpectrums( InputArray _src, OutputArray _dst)
|
||||
}
|
||||
else
|
||||
{
|
||||
const double* dataSrc = (const double*)src.data;
|
||||
double* dataDst = (double*)dst.data;
|
||||
const double* dataSrc = src.ptr<double>();
|
||||
double* dataDst = dst.ptr<double>();
|
||||
|
||||
size_t stepSrc = src.step/sizeof(dataSrc[0]);
|
||||
size_t stepDst = dst.step/sizeof(dataDst[0]);
|
||||
@@ -179,9 +179,9 @@ static void divSpectrums( InputArray _srcA, InputArray _srcB, OutputArray _dst,
|
||||
|
||||
if( depth == CV_32F )
|
||||
{
|
||||
const float* dataA = (const float*)srcA.data;
|
||||
const float* dataB = (const float*)srcB.data;
|
||||
float* dataC = (float*)dst.data;
|
||||
const float* dataA = srcA.ptr<float>();
|
||||
const float* dataB = srcB.ptr<float>();
|
||||
float* dataC = dst.ptr<float>();
|
||||
float eps = FLT_EPSILON; // prevent div0 problems
|
||||
|
||||
size_t stepA = srcA.step/sizeof(dataA[0]);
|
||||
@@ -264,9 +264,9 @@ static void divSpectrums( InputArray _srcA, InputArray _srcB, OutputArray _dst,
|
||||
}
|
||||
else
|
||||
{
|
||||
const double* dataA = (const double*)srcA.data;
|
||||
const double* dataB = (const double*)srcB.data;
|
||||
double* dataC = (double*)dst.data;
|
||||
const double* dataA = srcA.ptr<double>();
|
||||
const double* dataB = srcB.ptr<double>();
|
||||
double* dataC = dst.ptr<double>();
|
||||
double eps = DBL_EPSILON; // prevent div0 problems
|
||||
|
||||
size_t stepA = srcA.step/sizeof(dataA[0]);
|
||||
@@ -444,7 +444,7 @@ static Point2d weightedCentroid(InputArray _src, cv::Point peakLocation, cv::Siz
|
||||
|
||||
if(type == CV_32FC1)
|
||||
{
|
||||
const float* dataIn = (const float*)src.data;
|
||||
const float* dataIn = src.ptr<float>();
|
||||
dataIn += minr*src.cols;
|
||||
for(int y = minr; y <= maxr; y++)
|
||||
{
|
||||
@@ -460,7 +460,7 @@ static Point2d weightedCentroid(InputArray _src, cv::Point peakLocation, cv::Siz
|
||||
}
|
||||
else
|
||||
{
|
||||
const double* dataIn = (const double*)src.data;
|
||||
const double* dataIn = src.ptr<double>();
|
||||
dataIn += minr*src.cols;
|
||||
for(int y = minr; y <= maxr; y++)
|
||||
{
|
||||
|
@@ -230,7 +230,7 @@ pyrDown_( const Mat& _src, Mat& _dst, int borderType )
|
||||
|
||||
for( int y = 0; y < dsize.height; y++ )
|
||||
{
|
||||
T* dst = (T*)(_dst.data + _dst.step*y);
|
||||
T* dst = _dst.ptr<T>(y);
|
||||
WT *row0, *row1, *row2, *row3, *row4;
|
||||
|
||||
// fill the ring buffer (horizontal convolution and decimation)
|
||||
@@ -238,7 +238,7 @@ pyrDown_( const Mat& _src, Mat& _dst, int borderType )
|
||||
{
|
||||
WT* row = buf + ((sy - sy0) % PD_SZ)*bufstep;
|
||||
int _sy = borderInterpolate(sy, ssize.height, borderType);
|
||||
const T* src = (const T*)(_src.data + _src.step*_sy);
|
||||
const T* src = _src.ptr<T>(_sy);
|
||||
int limit = cn;
|
||||
const int* tab = tabL;
|
||||
|
||||
@@ -340,8 +340,8 @@ pyrUp_( const Mat& _src, Mat& _dst, int)
|
||||
|
||||
for( int y = 0; y < ssize.height; y++ )
|
||||
{
|
||||
T* dst0 = (T*)(_dst.data + _dst.step*y*2);
|
||||
T* dst1 = (T*)(_dst.data + _dst.step*(y*2+1));
|
||||
T* dst0 = _dst.ptr<T>(y*2);
|
||||
T* dst1 = _dst.ptr<T>(y*2+1);
|
||||
WT *row0, *row1, *row2;
|
||||
|
||||
if( y*2+1 >= dsize.height )
|
||||
@@ -352,7 +352,7 @@ pyrUp_( const Mat& _src, Mat& _dst, int)
|
||||
{
|
||||
WT* row = buf + ((sy - sy0) % PU_SZ)*bufstep;
|
||||
int _sy = borderInterpolate(sy*2, dsize.height, BORDER_REFLECT_101)/2;
|
||||
const T* src = (const T*)(_src.data + _src.step*_sy);
|
||||
const T* src = _src.ptr<T>(_sy);
|
||||
|
||||
if( ssize.width == cn )
|
||||
{
|
||||
|
@@ -356,7 +356,7 @@ cv::RotatedRect cv::minAreaRect( InputArray _points )
|
||||
}
|
||||
|
||||
int n = hull.checkVector(2);
|
||||
const Point2f* hpoints = (const Point2f*)hull.data;
|
||||
const Point2f* hpoints = hull.ptr<Point2f>();
|
||||
|
||||
if( n > 2 )
|
||||
{
|
||||
@@ -402,5 +402,5 @@ void cv::boxPoints(cv::RotatedRect box, OutputArray _pts)
|
||||
{
|
||||
_pts.create(4, 2, CV_32F);
|
||||
Mat pts = _pts.getMat();
|
||||
box.points((Point2f*)pts.data);
|
||||
box.points(pts.ptr<Point2f>());
|
||||
}
|
||||
|
@@ -392,7 +392,7 @@ void cv::getRectSubPix( InputArray _image, Size patchSize, Point2f center,
|
||||
|
||||
if( ippfunc)
|
||||
{
|
||||
if (ippfunc(image.data, (int)image.step, src_size, patch.data,
|
||||
if (ippfunc(image.ptr(), (int)image.step, src_size, patch.ptr(),
|
||||
(int)patch.step, win_size, icenter, &minpt, &maxpt) >= 0 )
|
||||
return;
|
||||
setIppErrorStatus();
|
||||
@@ -401,13 +401,13 @@ void cv::getRectSubPix( InputArray _image, Size patchSize, Point2f center,
|
||||
|
||||
if( depth == CV_8U && ddepth == CV_8U )
|
||||
getRectSubPix_Cn_<uchar, uchar, int, scale_fixpt, cast_8u>
|
||||
(image.data, image.step, image.size(), patch.data, patch.step, patch.size(), center, cn);
|
||||
(image.ptr(), image.step, image.size(), patch.ptr(), patch.step, patch.size(), center, cn);
|
||||
else if( depth == CV_8U && ddepth == CV_32F )
|
||||
getRectSubPix_8u32f
|
||||
(image.data, image.step, image.size(), (float*)patch.data, patch.step, patch.size(), center, cn);
|
||||
(image.ptr(), image.step, image.size(), patch.ptr<float>(), patch.step, patch.size(), center, cn);
|
||||
else if( depth == CV_32F && ddepth == CV_32F )
|
||||
getRectSubPix_Cn_<float, float, float, nop<float>, nop<float> >
|
||||
((const float*)image.data, image.step, image.size(), (float*)patch.data, patch.step, patch.size(), center, cn);
|
||||
(image.ptr<float>(), image.step, image.size(), patch.ptr<float>(), patch.step, patch.size(), center, cn);
|
||||
else
|
||||
CV_Error( CV_StsUnsupportedFormat, "Unsupported combination of input and output formats");
|
||||
}
|
||||
@@ -427,8 +427,8 @@ cvGetRectSubPix( const void* srcarr, void* dstarr, CvPoint2D32f center )
|
||||
CV_IMPL void
|
||||
cvGetQuadrangleSubPix( const void* srcarr, void* dstarr, const CvMat* mat )
|
||||
{
|
||||
cv::Mat src = cv::cvarrToMat(srcarr), m = cv::cvarrToMat(mat);
|
||||
const cv::Mat dst = cv::cvarrToMat(dstarr);
|
||||
const cv::Mat src = cv::cvarrToMat(srcarr), m = cv::cvarrToMat(mat);
|
||||
cv::Mat dst = cv::cvarrToMat(dstarr);
|
||||
|
||||
CV_Assert( src.channels() == dst.channels() );
|
||||
|
||||
@@ -442,8 +442,8 @@ cvGetQuadrangleSubPix( const void* srcarr, void* dstarr, const CvMat* mat )
|
||||
matrix[5] -= matrix[3]*dx + matrix[4]*dy;
|
||||
|
||||
if( src.depth() == CV_8U && dst.depth() == CV_32F )
|
||||
cv::getQuadrangleSubPix_8u32f_CnR( src.data, src.step, src.size(),
|
||||
(float*)dst.data, dst.step, dst.size(),
|
||||
cv::getQuadrangleSubPix_8u32f_CnR( src.ptr(), src.step, src.size(),
|
||||
dst.ptr<float>(), dst.step, dst.size(),
|
||||
matrix, src.channels());
|
||||
else
|
||||
{
|
||||
|
@@ -147,7 +147,7 @@ void cv::watershed( InputArray _src, InputOutputArray _markers )
|
||||
CV_Assert( src.type() == CV_8UC3 && dst.type() == CV_32SC1 );
|
||||
CV_Assert( src.size() == dst.size() );
|
||||
|
||||
const uchar* img = src.data;
|
||||
const uchar* img = src.ptr();
|
||||
int istep = int(src.step/sizeof(img[0]));
|
||||
int* mask = dst.ptr<int>();
|
||||
int mstep = int(dst.step / sizeof(mask[0]));
|
||||
@@ -210,7 +210,7 @@ void cv::watershed( InputArray _src, InputOutputArray _markers )
|
||||
return;
|
||||
|
||||
active_queue = i;
|
||||
img = src.data;
|
||||
img = src.ptr();
|
||||
mask = dst.ptr<int>();
|
||||
|
||||
// recursively fill the basins
|
||||
@@ -370,7 +370,7 @@ void cv::pyrMeanShiftFiltering( InputArray _src, OutputArray _dst,
|
||||
{
|
||||
cv::Mat src = src_pyramid[level];
|
||||
cv::Size size = src.size();
|
||||
uchar* sptr = src.data;
|
||||
const uchar* sptr = src.ptr();
|
||||
int sstep = (int)src.step;
|
||||
uchar* mask = 0;
|
||||
int mstep = 0;
|
||||
@@ -382,11 +382,11 @@ void cv::pyrMeanShiftFiltering( InputArray _src, OutputArray _dst,
|
||||
if( level < max_level )
|
||||
{
|
||||
cv::Size size1 = dst_pyramid[level+1].size();
|
||||
cv::Mat m( size.height, size.width, CV_8UC1, mask0.data );
|
||||
cv::Mat m( size.height, size.width, CV_8UC1, mask0.ptr() );
|
||||
dstep = (int)dst_pyramid[level+1].step;
|
||||
dptr = dst_pyramid[level+1].data + dstep + cn;
|
||||
dptr = dst_pyramid[level+1].ptr() + dstep + cn;
|
||||
mstep = (int)m.step;
|
||||
mask = m.data + mstep;
|
||||
mask = m.ptr() + mstep;
|
||||
//cvResize( dst_pyramid[level+1], dst_pyramid[level], CV_INTER_CUBIC );
|
||||
cv::pyrUp( dst_pyramid[level+1], dst_pyramid[level], dst_pyramid[level].size() );
|
||||
m.setTo(cv::Scalar::all(0));
|
||||
@@ -402,10 +402,10 @@ void cv::pyrMeanShiftFiltering( InputArray _src, OutputArray _dst,
|
||||
}
|
||||
|
||||
cv::dilate( m, m, cv::Mat() );
|
||||
mask = m.data;
|
||||
mask = m.ptr();
|
||||
}
|
||||
|
||||
dptr = dst_pyramid[level].data;
|
||||
dptr = dst_pyramid[level].ptr();
|
||||
dstep = (int)dst_pyramid[level].step;
|
||||
|
||||
for( i = 0; i < size.height; i++, sptr += sstep - size.width*3,
|
||||
@@ -425,7 +425,7 @@ void cv::pyrMeanShiftFiltering( InputArray _src, OutputArray _dst,
|
||||
// iterate meanshift procedure
|
||||
for( iter = 0; iter < termcrit.maxCount; iter++ )
|
||||
{
|
||||
uchar* ptr;
|
||||
const uchar* ptr;
|
||||
int x, y, count = 0;
|
||||
int minx, miny, maxx, maxy;
|
||||
int s0 = 0, s1 = 0, s2 = 0, sx = 0, sy = 0;
|
||||
|
@@ -212,8 +212,8 @@ void cv::minEnclosingCircle( InputArray _points, Point2f& _center, float& _radiu
|
||||
return;
|
||||
|
||||
bool is_float = depth == CV_32F;
|
||||
const Point* ptsi = (const Point*)points.data;
|
||||
const Point2f* ptsf = (const Point2f*)points.data;
|
||||
const Point* ptsi = points.ptr<Point>();
|
||||
const Point2f* ptsf = points.ptr<Point2f>();
|
||||
|
||||
Point2f pt = is_float ? ptsf[0] : Point2f((float)ptsi[0].x,(float)ptsi[0].y);
|
||||
Point2f pts[4] = {pt, pt, pt, pt};
|
||||
@@ -310,8 +310,8 @@ double cv::arcLength( InputArray _curve, bool is_closed )
|
||||
|
||||
bool is_float = depth == CV_32F;
|
||||
int last = is_closed ? count-1 : 0;
|
||||
const Point* pti = (const Point*)curve.data;
|
||||
const Point2f* ptf = (const Point2f*)curve.data;
|
||||
const Point* pti = curve.ptr<Point>();
|
||||
const Point2f* ptf = curve.ptr<Point2f>();
|
||||
|
||||
Point2f prev = is_float ? ptf[last] : Point2f((float)pti[last].x,(float)pti[last].y);
|
||||
|
||||
@@ -347,8 +347,8 @@ double cv::contourArea( InputArray _contour, bool oriented )
|
||||
|
||||
double a00 = 0;
|
||||
bool is_float = depth == CV_32F;
|
||||
const Point* ptsi = (const Point*)contour.data;
|
||||
const Point2f* ptsf = (const Point2f*)contour.data;
|
||||
const Point* ptsi = contour.ptr<Point>();
|
||||
const Point2f* ptsf = contour.ptr<Point2f>();
|
||||
Point2f prev = is_float ? ptsf[npoints-1] : Point2f((float)ptsi[npoints-1].x, (float)ptsi[npoints-1].y);
|
||||
|
||||
for( int i = 0; i < npoints; i++ )
|
||||
@@ -383,8 +383,8 @@ cv::RotatedRect cv::fitEllipse( InputArray _points )
|
||||
double gfp[5], rp[5], t;
|
||||
const double min_eps = 1e-8;
|
||||
bool is_float = depth == CV_32F;
|
||||
const Point* ptsi = (const Point*)points.data;
|
||||
const Point2f* ptsf = (const Point2f*)points.data;
|
||||
const Point* ptsi = points.ptr<Point>();
|
||||
const Point2f* ptsf = points.ptr<Point2f>();
|
||||
|
||||
AutoBuffer<double> _Ad(n*5), _bd(n);
|
||||
double *Ad = _Ad, *bd = _bd;
|
||||
@@ -493,7 +493,7 @@ static Rect pointSetBoundingRect( const Mat& points )
|
||||
if( npoints == 0 )
|
||||
return Rect();
|
||||
|
||||
const Point* pts = (const Point*)points.data;
|
||||
const Point* pts = points.ptr<Point>();
|
||||
Point pt = pts[0];
|
||||
|
||||
#if CV_SSE4_2
|
||||
|
@@ -953,7 +953,7 @@ void cv::boxFilter( InputArray _src, OutputArray _dst, int ddepth,
|
||||
Ipp8u * buffer = ippsMalloc_8u(bufSize); \
|
||||
ippType borderValue[4] = { 0, 0, 0, 0 }; \
|
||||
ippBorderType = ippBorderType == BORDER_CONSTANT ? ippBorderConst : ippBorderRepl; \
|
||||
IppStatus status = ippiFilterBoxBorder_##flavor((const ippType *)src.data, (int)src.step, (ippType *)dst.data, \
|
||||
IppStatus status = ippiFilterBoxBorder_##flavor(src.ptr<ippType>(), (int)src.step, dst.ptr<ippType>(), \
|
||||
(int)dst.step, roiSize, maskSize, \
|
||||
(IppiBorderType)ippBorderType, borderValue, buffer); \
|
||||
ippsFree(buffer); \
|
||||
@@ -1141,8 +1141,8 @@ cv::Mat cv::getGaussianKernel( int n, double sigma, int ktype )
|
||||
|
||||
CV_Assert( ktype == CV_32F || ktype == CV_64F );
|
||||
Mat kernel(n, 1, ktype);
|
||||
float* cf = (float*)kernel.data;
|
||||
double* cd = (double*)kernel.data;
|
||||
float* cf = kernel.ptr<float>();
|
||||
double* cd = kernel.ptr<double>();
|
||||
|
||||
double sigmaX = sigma > 0 ? sigma : ((n-1)*0.5 - 1)*0.3 + 0.8;
|
||||
double scale2X = -0.5/(sigmaX*sigmaX);
|
||||
@@ -1272,10 +1272,10 @@ void cv::GaussianBlur( InputArray _src, OutputArray _dst, Size ksize,
|
||||
typedef Ipp##ippfavor ippType; \
|
||||
ippType borderValues[] = { 0, 0, 0 }; \
|
||||
IppStatus status = ippcn == 1 ? \
|
||||
ippiFilterGaussianBorder_##ippfavor##_C1R((const ippType *)src.data, (int)src.step, \
|
||||
(ippType *)dst.data, (int)dst.step, roiSize, borderValues[0], pSpec, pBuffer) : \
|
||||
ippiFilterGaussianBorder_##ippfavor##_C3R((const ippType *)src.data, (int)src.step, \
|
||||
(ippType *)dst.data, (int)dst.step, roiSize, borderValues, pSpec, pBuffer); \
|
||||
ippiFilterGaussianBorder_##ippfavor##_C1R(src.ptr<ippType>(), (int)src.step, \
|
||||
dst.ptr<ippType>(), (int)dst.step, roiSize, borderValues[0], pSpec, pBuffer) : \
|
||||
ippiFilterGaussianBorder_##ippfavor##_C3R(src.ptr<ippType>(), (int)src.step, \
|
||||
dst.ptr<ippType>(), (int)dst.step, roiSize, borderValues, pSpec, pBuffer); \
|
||||
ippFree(pBuffer); \
|
||||
ippFree(pSpec); \
|
||||
if (status >= 0) \
|
||||
@@ -1418,8 +1418,8 @@ medianBlur_8u_O1( const Mat& _src, Mat& _dst, int ksize )
|
||||
for( int x = 0; x < _dst.cols; x += STRIPE_SIZE )
|
||||
{
|
||||
int i, j, k, c, n = std::min(_dst.cols - x, STRIPE_SIZE) + r*2;
|
||||
const uchar* src = _src.data + x*cn;
|
||||
uchar* dst = _dst.data + (x - r)*cn;
|
||||
const uchar* src = _src.ptr() + x*cn;
|
||||
uchar* dst = _dst.ptr() + (x - r)*cn;
|
||||
|
||||
memset( h_coarse, 0, 16*n*cn*sizeof(h_coarse[0]) );
|
||||
memset( h_fine, 0, 16*16*n*cn*sizeof(h_fine[0]) );
|
||||
@@ -1601,8 +1601,8 @@ medianBlur_8u_Om( const Mat& _src, Mat& _dst, int m )
|
||||
int x, y;
|
||||
int n2 = m*m/2;
|
||||
Size size = _dst.size();
|
||||
const uchar* src = _src.data;
|
||||
uchar* dst = _dst.data;
|
||||
const uchar* src = _src.ptr();
|
||||
uchar* dst = _dst.ptr();
|
||||
int src_step = (int)_src.step, dst_step = (int)_dst.step;
|
||||
int cn = _src.channels();
|
||||
const uchar* src_max = src + size.height*src_step;
|
||||
@@ -1878,8 +1878,8 @@ medianBlur_SortNet( const Mat& _src, Mat& _dst, int m )
|
||||
typedef typename Op::arg_type WT;
|
||||
typedef typename VecOp::arg_type VT;
|
||||
|
||||
const T* src = (const T*)_src.data;
|
||||
T* dst = (T*)_dst.data;
|
||||
const T* src = _src.ptr<T>();
|
||||
T* dst = _dst.ptr<T>();
|
||||
int sstep = (int)(_src.step/sizeof(T));
|
||||
int dstep = (int)(_dst.step/sizeof(T));
|
||||
Size size = _dst.size();
|
||||
@@ -2162,8 +2162,8 @@ void cv::medianBlur( InputArray _src0, OutputArray _dst, int ksize )
|
||||
ippDataType, CV_MAT_CN(type), &bufSize) >= 0) \
|
||||
{ \
|
||||
Ipp8u * buffer = ippsMalloc_8u(bufSize); \
|
||||
IppStatus status = ippiFilterMedianBorder_##flavor((const ippType *)src0.data, (int)src0.step, \
|
||||
(ippType *)dst.data, (int)dst.step, dstRoiSize, maskSize, \
|
||||
IppStatus status = ippiFilterMedianBorder_##flavor(src0.ptr<ippType>(), (int)src0.step, \
|
||||
dst.ptr<ippType>(), (int)dst.step, dstRoiSize, maskSize, \
|
||||
ippBorderRepl, (ippType)0, buffer); \
|
||||
ippsFree(buffer); \
|
||||
if (status >= 0) \
|
||||
|
@@ -419,8 +419,8 @@ void cv::integral( InputArray _src, OutputArray _sum, OutputArray _sqsum, Output
|
||||
else
|
||||
CV_Error( CV_StsUnsupportedFormat, "" );
|
||||
|
||||
func( src.data, src.step, sum.data, sum.step, sqsum.data, sqsum.step,
|
||||
tilted.data, tilted.step, src.size(), cn );
|
||||
func( src.ptr(), src.step, sum.ptr(), sum.step, sqsum.ptr(), sqsum.step,
|
||||
tilted.ptr(), tilted.step, src.size(), cn );
|
||||
}
|
||||
|
||||
void cv::integral( InputArray src, OutputArray sum, int sdepth )
|
||||
|
@@ -591,7 +591,7 @@ static bool ipp_crossCorr(const Mat& src, const Mat& tpl, Mat& dst)
|
||||
|
||||
pBuffer = ippsMalloc_8u( bufSize );
|
||||
|
||||
status = ippFunc(src.data, (int)src.step, srcRoiSize, tpl.data, (int)tpl.step, tplRoiSize, (Ipp32f*)dst.data, (int)dst.step, funCfg, pBuffer);
|
||||
status = ippFunc(src.ptr(), (int)src.step, srcRoiSize, tpl.ptr(), (int)tpl.step, tplRoiSize, dst.ptr<Ipp32f>(), (int)dst.step, funCfg, pBuffer);
|
||||
|
||||
ippsFree( pBuffer );
|
||||
return status >= 0;
|
||||
@@ -624,7 +624,7 @@ static bool ipp_sqrDistance(const Mat& src, const Mat& tpl, Mat& dst)
|
||||
|
||||
pBuffer = ippsMalloc_8u( bufSize );
|
||||
|
||||
status = ippFunc(src.data, (int)src.step, srcRoiSize, tpl.data, (int)tpl.step, tplRoiSize, (Ipp32f*)dst.data, (int)dst.step, funCfg, pBuffer);
|
||||
status = ippFunc(src.ptr(), (int)src.step, srcRoiSize, tpl.ptr(), (int)tpl.step, tplRoiSize, dst.ptr<Ipp32f>(), (int)dst.step, funCfg, pBuffer);
|
||||
|
||||
ippsFree( pBuffer );
|
||||
return status >= 0;
|
||||
@@ -934,7 +934,7 @@ void cv::matchTemplate( InputArray _img, InputArray _templ, OutputArray _result,
|
||||
|
||||
for( i = 0; i < result.rows; i++ )
|
||||
{
|
||||
float* rrow = (float*)(result.data + i*result.step);
|
||||
float* rrow = result.ptr<float>(i);
|
||||
int idx = i * sumstep;
|
||||
int idx2 = i * sqstep;
|
||||
|
||||
|
@@ -75,28 +75,28 @@ thresh_8u( const Mat& _src, Mat& _dst, uchar thresh, uchar maxval, int type )
|
||||
{
|
||||
case THRESH_TRUNC:
|
||||
#ifndef HAVE_IPP_ICV_ONLY
|
||||
if (_src.data == _dst.data && ippiThreshold_GT_8u_C1IR(_src.data, (int)src_step, sz, thresh) >= 0)
|
||||
if (_src.data == _dst.data && ippiThreshold_GT_8u_C1IR(_src.ptr(), (int)src_step, sz, thresh) >= 0)
|
||||
return;
|
||||
#endif
|
||||
if (ippiThreshold_GT_8u_C1R(_src.data, (int)src_step, _dst.data, (int)dst_step, sz, thresh) >= 0)
|
||||
if (ippiThreshold_GT_8u_C1R(_src.ptr(), (int)src_step, _dst.ptr(), (int)dst_step, sz, thresh) >= 0)
|
||||
return;
|
||||
setIppErrorStatus();
|
||||
break;
|
||||
case THRESH_TOZERO:
|
||||
#ifndef HAVE_IPP_ICV_ONLY
|
||||
if (_src.data == _dst.data && ippiThreshold_LTVal_8u_C1IR(_src.data, (int)src_step, sz, thresh+1, 0) >= 0)
|
||||
if (_src.data == _dst.data && ippiThreshold_LTVal_8u_C1IR(_src.ptr(), (int)src_step, sz, thresh+1, 0) >= 0)
|
||||
return;
|
||||
#endif
|
||||
if (ippiThreshold_LTVal_8u_C1R(_src.data, (int)src_step, _dst.data, (int)dst_step, sz, thresh+1, 0) >= 0)
|
||||
if (ippiThreshold_LTVal_8u_C1R(_src.ptr(), (int)src_step, _dst.ptr(), (int)dst_step, sz, thresh+1, 0) >= 0)
|
||||
return;
|
||||
setIppErrorStatus();
|
||||
break;
|
||||
case THRESH_TOZERO_INV:
|
||||
#ifndef HAVE_IPP_ICV_ONLY
|
||||
if (_src.data == _dst.data && ippiThreshold_GTVal_8u_C1IR(_src.data, (int)src_step, sz, thresh, 0) >= 0)
|
||||
if (_src.data == _dst.data && ippiThreshold_GTVal_8u_C1IR(_src.ptr(), (int)src_step, sz, thresh, 0) >= 0)
|
||||
return;
|
||||
#endif
|
||||
if (ippiThreshold_GTVal_8u_C1R(_src.data, (int)src_step, _dst.data, (int)dst_step, sz, thresh, 0) >= 0)
|
||||
if (ippiThreshold_GTVal_8u_C1R(_src.ptr(), (int)src_step, _dst.ptr(), (int)dst_step, sz, thresh, 0) >= 0)
|
||||
return;
|
||||
setIppErrorStatus();
|
||||
break;
|
||||
@@ -151,8 +151,8 @@ thresh_8u( const Mat& _src, Mat& _dst, uchar thresh, uchar maxval, int type )
|
||||
|
||||
for( i = 0; i < roi.height; i++ )
|
||||
{
|
||||
const uchar* src = (const uchar*)(_src.data + src_step*i);
|
||||
uchar* dst = (uchar*)(_dst.data + dst_step*i);
|
||||
const uchar* src = _src.ptr() + src_step*i;
|
||||
uchar* dst = _dst.ptr() + dst_step*i;
|
||||
|
||||
switch( type )
|
||||
{
|
||||
@@ -270,8 +270,8 @@ thresh_8u( const Mat& _src, Mat& _dst, uchar thresh, uchar maxval, int type )
|
||||
{
|
||||
for( i = 0; i < roi.height; i++ )
|
||||
{
|
||||
const uchar* src = (const uchar*)(_src.data + src_step*i);
|
||||
uchar* dst = (uchar*)(_dst.data + dst_step*i);
|
||||
const uchar* src = _src.ptr() + src_step*i;
|
||||
uchar* dst = _dst.ptr() + dst_step*i;
|
||||
j = j_scalar;
|
||||
#if CV_ENABLE_UNROLLED
|
||||
for( ; j <= roi.width - 4; j += 4 )
|
||||
@@ -302,8 +302,8 @@ thresh_16s( const Mat& _src, Mat& _dst, short thresh, short maxval, int type )
|
||||
int i, j;
|
||||
Size roi = _src.size();
|
||||
roi.width *= _src.channels();
|
||||
const short* src = (const short*)_src.data;
|
||||
short* dst = (short*)_dst.data;
|
||||
const short* src = _src.ptr<short>();
|
||||
short* dst = _dst.ptr<short>();
|
||||
size_t src_step = _src.step/sizeof(src[0]);
|
||||
size_t dst_step = _dst.step/sizeof(dst[0]);
|
||||
|
||||
@@ -511,8 +511,8 @@ thresh_32f( const Mat& _src, Mat& _dst, float thresh, float maxval, int type )
|
||||
int i, j;
|
||||
Size roi = _src.size();
|
||||
roi.width *= _src.channels();
|
||||
const float* src = (const float*)_src.data;
|
||||
float* dst = (float*)_dst.data;
|
||||
const float* src = _src.ptr<float>();
|
||||
float* dst = _dst.ptr<float>();
|
||||
size_t src_step = _src.step/sizeof(src[0]);
|
||||
size_t dst_step = _dst.step/sizeof(dst[0]);
|
||||
|
||||
@@ -715,7 +715,7 @@ getThreshVal_Otsu_8u( const Mat& _src )
|
||||
IppiSize srcSize = { size.width, size.height };
|
||||
Ipp8u thresh;
|
||||
CV_SUPPRESS_DEPRECATED_START
|
||||
IppStatus ok = ippiComputeThreshold_Otsu_8u_C1R(_src.data, step, srcSize, &thresh);
|
||||
IppStatus ok = ippiComputeThreshold_Otsu_8u_C1R(_src.ptr(), step, srcSize, &thresh);
|
||||
CV_SUPPRESS_DEPRECATED_END
|
||||
if (ok >= 0)
|
||||
return thresh;
|
||||
@@ -726,7 +726,7 @@ getThreshVal_Otsu_8u( const Mat& _src )
|
||||
int i, j, h[N] = {0};
|
||||
for( i = 0; i < size.height; i++ )
|
||||
{
|
||||
const uchar* src = _src.data + step*i;
|
||||
const uchar* src = _src.ptr() + step*i;
|
||||
j = 0;
|
||||
#if CV_ENABLE_UNROLLED
|
||||
for( ; j <= size.width - 4; j += 4 )
|
||||
@@ -1003,9 +1003,9 @@ void cv::adaptiveThreshold( InputArray _src, OutputArray _dst, double maxValue,
|
||||
|
||||
for( i = 0; i < size.height; i++ )
|
||||
{
|
||||
const uchar* sdata = src.data + src.step*i;
|
||||
const uchar* mdata = mean.data + mean.step*i;
|
||||
uchar* ddata = dst.data + dst.step*i;
|
||||
const uchar* sdata = src.ptr(i);
|
||||
const uchar* mdata = mean.ptr(i);
|
||||
uchar* ddata = dst.ptr(i);
|
||||
|
||||
for( j = 0; j < size.width; j++ )
|
||||
ddata[j] = tab[sdata[j] - mdata[j] + 255];
|
||||
|
@@ -53,8 +53,8 @@ cv::Mat cv::getDefaultNewCameraMatrix( InputArray _cameraMatrix, Size imgsize,
|
||||
cameraMatrix.convertTo(newCameraMatrix, CV_64F);
|
||||
if( centerPrincipalPoint )
|
||||
{
|
||||
((double*)newCameraMatrix.data)[2] = (imgsize.width-1)*0.5;
|
||||
((double*)newCameraMatrix.data)[5] = (imgsize.height-1)*0.5;
|
||||
newCameraMatrix.ptr<double>()[2] = (imgsize.width-1)*0.5;
|
||||
newCameraMatrix.ptr<double>()[5] = (imgsize.height-1)*0.5;
|
||||
}
|
||||
return newCameraMatrix;
|
||||
}
|
||||
@@ -82,15 +82,15 @@ void cv::initUndistortRectifyMap( InputArray _cameraMatrix, InputArray _distCoef
|
||||
Mat_<double> R = Mat_<double>::eye(3, 3);
|
||||
Mat_<double> A = Mat_<double>(cameraMatrix), Ar;
|
||||
|
||||
if( newCameraMatrix.data )
|
||||
if( !newCameraMatrix.empty() )
|
||||
Ar = Mat_<double>(newCameraMatrix);
|
||||
else
|
||||
Ar = getDefaultNewCameraMatrix( A, size, true );
|
||||
|
||||
if( matR.data )
|
||||
if( !matR.empty() )
|
||||
R = Mat_<double>(matR);
|
||||
|
||||
if( distCoeffs.data )
|
||||
if( !distCoeffs.empty() )
|
||||
distCoeffs = Mat_<double>(distCoeffs);
|
||||
else
|
||||
{
|
||||
@@ -114,23 +114,24 @@ void cv::initUndistortRectifyMap( InputArray _cameraMatrix, InputArray _distCoef
|
||||
if( distCoeffs.rows != 1 && !distCoeffs.isContinuous() )
|
||||
distCoeffs = distCoeffs.t();
|
||||
|
||||
double k1 = ((double*)distCoeffs.data)[0];
|
||||
double k2 = ((double*)distCoeffs.data)[1];
|
||||
double p1 = ((double*)distCoeffs.data)[2];
|
||||
double p2 = ((double*)distCoeffs.data)[3];
|
||||
double k3 = distCoeffs.cols + distCoeffs.rows - 1 >= 5 ? ((double*)distCoeffs.data)[4] : 0.;
|
||||
double k4 = distCoeffs.cols + distCoeffs.rows - 1 >= 8 ? ((double*)distCoeffs.data)[5] : 0.;
|
||||
double k5 = distCoeffs.cols + distCoeffs.rows - 1 >= 8 ? ((double*)distCoeffs.data)[6] : 0.;
|
||||
double k6 = distCoeffs.cols + distCoeffs.rows - 1 >= 8 ? ((double*)distCoeffs.data)[7] : 0.;
|
||||
double s1 = distCoeffs.cols + distCoeffs.rows - 1 >= 12 ? ((double*)distCoeffs.data)[8] : 0.;
|
||||
double s2 = distCoeffs.cols + distCoeffs.rows - 1 >= 12 ? ((double*)distCoeffs.data)[9] : 0.;
|
||||
double s3 = distCoeffs.cols + distCoeffs.rows - 1 >= 12 ? ((double*)distCoeffs.data)[10] : 0.;
|
||||
double s4 = distCoeffs.cols + distCoeffs.rows - 1 >= 12 ? ((double*)distCoeffs.data)[11] : 0.;
|
||||
const double* const distPtr = distCoeffs.ptr<double>();
|
||||
double k1 = distPtr[0];
|
||||
double k2 = distPtr[1];
|
||||
double p1 = distPtr[2];
|
||||
double p2 = distPtr[3];
|
||||
double k3 = distCoeffs.cols + distCoeffs.rows - 1 >= 5 ? distPtr[4] : 0.;
|
||||
double k4 = distCoeffs.cols + distCoeffs.rows - 1 >= 8 ? distPtr[5] : 0.;
|
||||
double k5 = distCoeffs.cols + distCoeffs.rows - 1 >= 8 ? distPtr[6] : 0.;
|
||||
double k6 = distCoeffs.cols + distCoeffs.rows - 1 >= 8 ? distPtr[7] : 0.;
|
||||
double s1 = distCoeffs.cols + distCoeffs.rows - 1 >= 12 ? distPtr[8] : 0.;
|
||||
double s2 = distCoeffs.cols + distCoeffs.rows - 1 >= 12 ? distPtr[9] : 0.;
|
||||
double s3 = distCoeffs.cols + distCoeffs.rows - 1 >= 12 ? distPtr[10] : 0.;
|
||||
double s4 = distCoeffs.cols + distCoeffs.rows - 1 >= 12 ? distPtr[11] : 0.;
|
||||
|
||||
for( int i = 0; i < size.height; i++ )
|
||||
{
|
||||
float* m1f = (float*)(map1.data + map1.step*i);
|
||||
float* m2f = (float*)(map2.data + map2.step*i);
|
||||
float* m1f = map1.ptr<float>(i);
|
||||
float* m2f = map2.ptr<float>(i);
|
||||
short* m1 = (short*)m1f;
|
||||
ushort* m2 = (ushort*)m2f;
|
||||
double _x = i*ir[1] + ir[2], _y = i*ir[4] + ir[5], _w = i*ir[7] + ir[8];
|
||||
@@ -183,7 +184,7 @@ void cv::undistort( InputArray _src, OutputArray _dst, InputArray _cameraMatrix,
|
||||
Mat_<double> A, Ar, I = Mat_<double>::eye(3,3);
|
||||
|
||||
cameraMatrix.convertTo(A, CV_64F);
|
||||
if( distCoeffs.data )
|
||||
if( !distCoeffs.empty() )
|
||||
distCoeffs = Mat_<double>(distCoeffs);
|
||||
else
|
||||
{
|
||||
@@ -191,7 +192,7 @@ void cv::undistort( InputArray _src, OutputArray _dst, InputArray _cameraMatrix,
|
||||
distCoeffs = 0.;
|
||||
}
|
||||
|
||||
if( newCameraMatrix.data )
|
||||
if( !newCameraMatrix.empty() )
|
||||
newCameraMatrix.convertTo(Ar, CV_64F);
|
||||
else
|
||||
A.copyTo(Ar);
|
||||
@@ -404,11 +405,11 @@ void cv::undistortPoints( InputArray _src, OutputArray _dst,
|
||||
|
||||
CvMat _csrc = src, _cdst = dst, _ccameraMatrix = cameraMatrix;
|
||||
CvMat matR, matP, _cdistCoeffs, *pR=0, *pP=0, *pD=0;
|
||||
if( R.data )
|
||||
if( !R.empty() )
|
||||
pR = &(matR = R);
|
||||
if( P.data )
|
||||
if( !P.empty() )
|
||||
pP = &(matP = P);
|
||||
if( distCoeffs.data )
|
||||
if( !distCoeffs.empty() )
|
||||
pD = &(_cdistCoeffs = distCoeffs);
|
||||
cvUndistortPoints(&_csrc, &_cdst, &_ccameraMatrix, pD, pR, pP);
|
||||
}
|
||||
|
Reference in New Issue
Block a user