Boring changes - imgproc.

This commit is contained in:
Roman Donchenko 2013-08-13 16:39:58 +04:00
parent 8200a95ced
commit 254d4ae429
11 changed files with 195 additions and 195 deletions

View File

@ -656,7 +656,7 @@ public:
Point dstOfs = Point(0,0),
bool isolated = false);
//! returns true if the filter is separable
bool isSeparable() const { return (const BaseFilter*)filter2D == 0; }
bool isSeparable() const { return !filter2D; }
//! returns the number
int remainingInputRows() const;
int remainingOutputRows() const;

View File

@ -330,5 +330,5 @@ namespace
cv::Ptr<cv::CLAHE> cv::createCLAHE(double clipLimit, cv::Size tileGridSize)
{
return new CLAHE_Impl(clipLimit, tileGridSize.width, tileGridSize.height);
return makePtr<CLAHE_Impl>(clipLimit, tileGridSize.width, tileGridSize.height);
}

View File

@ -1339,8 +1339,8 @@ icvFindContoursInInterval( const CvArr* src,
if( contourHeaderSize < (int)sizeof(CvContour))
CV_Error( CV_StsBadSize, "Contour header size must be >= sizeof(CvContour)" );
storage00 = cvCreateChildMemStorage(storage);
storage01 = cvCreateChildMemStorage(storage);
storage00.reset(cvCreateChildMemStorage(storage));
storage01.reset(cvCreateChildMemStorage(storage));
CvMat stub, *mat;

View File

@ -117,7 +117,7 @@ void FilterEngine::init( const Ptr<BaseFilter>& _filter2D,
if( isSeparable() )
{
CV_Assert( !rowFilter.empty() && !columnFilter.empty() );
CV_Assert( rowFilter && columnFilter );
ksize = Size(rowFilter->ksize, columnFilter->ksize);
anchor = Point(rowFilter->anchor, columnFilter->anchor);
}
@ -244,9 +244,9 @@ int FilterEngine::start(Size _wholeSize, Rect _roi, int _maxBufRows)
rowCount = dstY = 0;
startY = startY0 = std::max(roi.y - anchor.y, 0);
endY = std::min(roi.y + roi.height + ksize.height - anchor.y - 1, wholeSize.height);
if( !columnFilter.empty() )
if( columnFilter )
columnFilter->reset();
if( !filter2D.empty() )
if( filter2D )
filter2D->reset();
return startY;
@ -2735,42 +2735,42 @@ cv::Ptr<cv::BaseRowFilter> cv::getLinearRowFilter( int srcType, int bufType,
if( (symmetryType & (KERNEL_SYMMETRICAL|KERNEL_ASYMMETRICAL)) != 0 && ksize <= 5 )
{
if( sdepth == CV_8U && ddepth == CV_32S )
return Ptr<BaseRowFilter>(new SymmRowSmallFilter<uchar, int, SymmRowSmallVec_8u32s>
(kernel, anchor, symmetryType, SymmRowSmallVec_8u32s(kernel, symmetryType)));
return makePtr<SymmRowSmallFilter<uchar, int, SymmRowSmallVec_8u32s> >
(kernel, anchor, symmetryType, SymmRowSmallVec_8u32s(kernel, symmetryType));
if( sdepth == CV_32F && ddepth == CV_32F )
return Ptr<BaseRowFilter>(new SymmRowSmallFilter<float, float, SymmRowSmallVec_32f>
(kernel, anchor, symmetryType, SymmRowSmallVec_32f(kernel, symmetryType)));
return makePtr<SymmRowSmallFilter<float, float, SymmRowSmallVec_32f> >
(kernel, anchor, symmetryType, SymmRowSmallVec_32f(kernel, symmetryType));
}
if( sdepth == CV_8U && ddepth == CV_32S )
return Ptr<BaseRowFilter>(new RowFilter<uchar, int, RowVec_8u32s>
(kernel, anchor, RowVec_8u32s(kernel)));
return makePtr<RowFilter<uchar, int, RowVec_8u32s> >
(kernel, anchor, RowVec_8u32s(kernel));
if( sdepth == CV_8U && ddepth == CV_32F )
return Ptr<BaseRowFilter>(new RowFilter<uchar, float, RowNoVec>(kernel, anchor));
return makePtr<RowFilter<uchar, float, RowNoVec> >(kernel, anchor);
if( sdepth == CV_8U && ddepth == CV_64F )
return Ptr<BaseRowFilter>(new RowFilter<uchar, double, RowNoVec>(kernel, anchor));
return makePtr<RowFilter<uchar, double, RowNoVec> >(kernel, anchor);
if( sdepth == CV_16U && ddepth == CV_32F )
return Ptr<BaseRowFilter>(new RowFilter<ushort, float, RowNoVec>(kernel, anchor));
return makePtr<RowFilter<ushort, float, RowNoVec> >(kernel, anchor);
if( sdepth == CV_16U && ddepth == CV_64F )
return Ptr<BaseRowFilter>(new RowFilter<ushort, double, RowNoVec>(kernel, anchor));
return makePtr<RowFilter<ushort, double, RowNoVec> >(kernel, anchor);
if( sdepth == CV_16S && ddepth == CV_32F )
return Ptr<BaseRowFilter>(new RowFilter<short, float, RowVec_16s32f>
(kernel, anchor, RowVec_16s32f(kernel)));
return makePtr<RowFilter<short, float, RowVec_16s32f> >
(kernel, anchor, RowVec_16s32f(kernel));
if( sdepth == CV_16S && ddepth == CV_64F )
return Ptr<BaseRowFilter>(new RowFilter<short, double, RowNoVec>(kernel, anchor));
return makePtr<RowFilter<short, double, RowNoVec> >(kernel, anchor);
if( sdepth == CV_32F && ddepth == CV_32F )
return Ptr<BaseRowFilter>(new RowFilter<float, float, RowVec_32f>
(kernel, anchor, RowVec_32f(kernel)));
return makePtr<RowFilter<float, float, RowVec_32f> >
(kernel, anchor, RowVec_32f(kernel));
if( sdepth == CV_32F && ddepth == CV_64F )
return Ptr<BaseRowFilter>(new RowFilter<float, double, RowNoVec>(kernel, anchor));
return makePtr<RowFilter<float, double, RowNoVec> >(kernel, anchor);
if( sdepth == CV_64F && ddepth == CV_64F )
return Ptr<BaseRowFilter>(new RowFilter<double, double, RowNoVec>(kernel, anchor));
return makePtr<RowFilter<double, double, RowNoVec> >(kernel, anchor);
CV_Error_( CV_StsNotImplemented,
("Unsupported combination of source format (=%d), and buffer format (=%d)",
srcType, bufType));
return Ptr<BaseRowFilter>(0);
return Ptr<BaseRowFilter>();
}
@ -2789,24 +2789,24 @@ cv::Ptr<cv::BaseColumnFilter> cv::getLinearColumnFilter( int bufType, int dstTyp
if( !(symmetryType & (KERNEL_SYMMETRICAL|KERNEL_ASYMMETRICAL)) )
{
if( ddepth == CV_8U && sdepth == CV_32S )
return Ptr<BaseColumnFilter>(new ColumnFilter<FixedPtCastEx<int, uchar>, ColumnNoVec>
(kernel, anchor, delta, FixedPtCastEx<int, uchar>(bits)));
return makePtr<ColumnFilter<FixedPtCastEx<int, uchar>, ColumnNoVec> >
(kernel, anchor, delta, FixedPtCastEx<int, uchar>(bits));
if( ddepth == CV_8U && sdepth == CV_32F )
return Ptr<BaseColumnFilter>(new ColumnFilter<Cast<float, uchar>, ColumnNoVec>(kernel, anchor, delta));
return makePtr<ColumnFilter<Cast<float, uchar>, ColumnNoVec> >(kernel, anchor, delta);
if( ddepth == CV_8U && sdepth == CV_64F )
return Ptr<BaseColumnFilter>(new ColumnFilter<Cast<double, uchar>, ColumnNoVec>(kernel, anchor, delta));
return makePtr<ColumnFilter<Cast<double, uchar>, ColumnNoVec> >(kernel, anchor, delta);
if( ddepth == CV_16U && sdepth == CV_32F )
return Ptr<BaseColumnFilter>(new ColumnFilter<Cast<float, ushort>, ColumnNoVec>(kernel, anchor, delta));
return makePtr<ColumnFilter<Cast<float, ushort>, ColumnNoVec> >(kernel, anchor, delta);
if( ddepth == CV_16U && sdepth == CV_64F )
return Ptr<BaseColumnFilter>(new ColumnFilter<Cast<double, ushort>, ColumnNoVec>(kernel, anchor, delta));
return makePtr<ColumnFilter<Cast<double, ushort>, ColumnNoVec> >(kernel, anchor, delta);
if( ddepth == CV_16S && sdepth == CV_32F )
return Ptr<BaseColumnFilter>(new ColumnFilter<Cast<float, short>, ColumnNoVec>(kernel, anchor, delta));
return makePtr<ColumnFilter<Cast<float, short>, ColumnNoVec> >(kernel, anchor, delta);
if( ddepth == CV_16S && sdepth == CV_64F )
return Ptr<BaseColumnFilter>(new ColumnFilter<Cast<double, short>, ColumnNoVec>(kernel, anchor, delta));
return makePtr<ColumnFilter<Cast<double, short>, ColumnNoVec> >(kernel, anchor, delta);
if( ddepth == CV_32F && sdepth == CV_32F )
return Ptr<BaseColumnFilter>(new ColumnFilter<Cast<float, float>, ColumnNoVec>(kernel, anchor, delta));
return makePtr<ColumnFilter<Cast<float, float>, ColumnNoVec> >(kernel, anchor, delta);
if( ddepth == CV_64F && sdepth == CV_64F )
return Ptr<BaseColumnFilter>(new ColumnFilter<Cast<double, double>, ColumnNoVec>(kernel, anchor, delta));
return makePtr<ColumnFilter<Cast<double, double>, ColumnNoVec> >(kernel, anchor, delta);
}
else
{
@ -2814,60 +2814,60 @@ cv::Ptr<cv::BaseColumnFilter> cv::getLinearColumnFilter( int bufType, int dstTyp
if( ksize == 3 )
{
if( ddepth == CV_8U && sdepth == CV_32S )
return Ptr<BaseColumnFilter>(new SymmColumnSmallFilter<
FixedPtCastEx<int, uchar>, SymmColumnVec_32s8u>
return makePtr<SymmColumnSmallFilter<
FixedPtCastEx<int, uchar>, SymmColumnVec_32s8u> >
(kernel, anchor, delta, symmetryType, FixedPtCastEx<int, uchar>(bits),
SymmColumnVec_32s8u(kernel, symmetryType, bits, delta)));
SymmColumnVec_32s8u(kernel, symmetryType, bits, delta));
if( ddepth == CV_16S && sdepth == CV_32S && bits == 0 )
return Ptr<BaseColumnFilter>(new SymmColumnSmallFilter<Cast<int, short>,
SymmColumnSmallVec_32s16s>(kernel, anchor, delta, symmetryType,
Cast<int, short>(), SymmColumnSmallVec_32s16s(kernel, symmetryType, bits, delta)));
return makePtr<SymmColumnSmallFilter<Cast<int, short>,
SymmColumnSmallVec_32s16s> >(kernel, anchor, delta, symmetryType,
Cast<int, short>(), SymmColumnSmallVec_32s16s(kernel, symmetryType, bits, delta));
if( ddepth == CV_32F && sdepth == CV_32F )
return Ptr<BaseColumnFilter>(new SymmColumnSmallFilter<
Cast<float, float>,SymmColumnSmallVec_32f>
return makePtr<SymmColumnSmallFilter<
Cast<float, float>,SymmColumnSmallVec_32f> >
(kernel, anchor, delta, symmetryType, Cast<float, float>(),
SymmColumnSmallVec_32f(kernel, symmetryType, 0, delta)));
SymmColumnSmallVec_32f(kernel, symmetryType, 0, delta));
}
if( ddepth == CV_8U && sdepth == CV_32S )
return Ptr<BaseColumnFilter>(new SymmColumnFilter<FixedPtCastEx<int, uchar>, SymmColumnVec_32s8u>
return makePtr<SymmColumnFilter<FixedPtCastEx<int, uchar>, SymmColumnVec_32s8u> >
(kernel, anchor, delta, symmetryType, FixedPtCastEx<int, uchar>(bits),
SymmColumnVec_32s8u(kernel, symmetryType, bits, delta)));
SymmColumnVec_32s8u(kernel, symmetryType, bits, delta));
if( ddepth == CV_8U && sdepth == CV_32F )
return Ptr<BaseColumnFilter>(new SymmColumnFilter<Cast<float, uchar>, ColumnNoVec>
(kernel, anchor, delta, symmetryType));
return makePtr<SymmColumnFilter<Cast<float, uchar>, ColumnNoVec> >
(kernel, anchor, delta, symmetryType);
if( ddepth == CV_8U && sdepth == CV_64F )
return Ptr<BaseColumnFilter>(new SymmColumnFilter<Cast<double, uchar>, ColumnNoVec>
(kernel, anchor, delta, symmetryType));
return makePtr<SymmColumnFilter<Cast<double, uchar>, ColumnNoVec> >
(kernel, anchor, delta, symmetryType);
if( ddepth == CV_16U && sdepth == CV_32F )
return Ptr<BaseColumnFilter>(new SymmColumnFilter<Cast<float, ushort>, ColumnNoVec>
(kernel, anchor, delta, symmetryType));
return makePtr<SymmColumnFilter<Cast<float, ushort>, ColumnNoVec> >
(kernel, anchor, delta, symmetryType);
if( ddepth == CV_16U && sdepth == CV_64F )
return Ptr<BaseColumnFilter>(new SymmColumnFilter<Cast<double, ushort>, ColumnNoVec>
(kernel, anchor, delta, symmetryType));
return makePtr<SymmColumnFilter<Cast<double, ushort>, ColumnNoVec> >
(kernel, anchor, delta, symmetryType);
if( ddepth == CV_16S && sdepth == CV_32S )
return Ptr<BaseColumnFilter>(new SymmColumnFilter<Cast<int, short>, ColumnNoVec>
(kernel, anchor, delta, symmetryType));
return makePtr<SymmColumnFilter<Cast<int, short>, ColumnNoVec> >
(kernel, anchor, delta, symmetryType);
if( ddepth == CV_16S && sdepth == CV_32F )
return Ptr<BaseColumnFilter>(new SymmColumnFilter<Cast<float, short>, SymmColumnVec_32f16s>
return makePtr<SymmColumnFilter<Cast<float, short>, SymmColumnVec_32f16s> >
(kernel, anchor, delta, symmetryType, Cast<float, short>(),
SymmColumnVec_32f16s(kernel, symmetryType, 0, delta)));
SymmColumnVec_32f16s(kernel, symmetryType, 0, delta));
if( ddepth == CV_16S && sdepth == CV_64F )
return Ptr<BaseColumnFilter>(new SymmColumnFilter<Cast<double, short>, ColumnNoVec>
(kernel, anchor, delta, symmetryType));
return makePtr<SymmColumnFilter<Cast<double, short>, ColumnNoVec> >
(kernel, anchor, delta, symmetryType);
if( ddepth == CV_32F && sdepth == CV_32F )
return Ptr<BaseColumnFilter>(new SymmColumnFilter<Cast<float, float>, SymmColumnVec_32f>
return makePtr<SymmColumnFilter<Cast<float, float>, SymmColumnVec_32f> >
(kernel, anchor, delta, symmetryType, Cast<float, float>(),
SymmColumnVec_32f(kernel, symmetryType, 0, delta)));
SymmColumnVec_32f(kernel, symmetryType, 0, delta));
if( ddepth == CV_64F && sdepth == CV_64F )
return Ptr<BaseColumnFilter>(new SymmColumnFilter<Cast<double, double>, ColumnNoVec>
(kernel, anchor, delta, symmetryType));
return makePtr<SymmColumnFilter<Cast<double, double>, ColumnNoVec> >
(kernel, anchor, delta, symmetryType);
}
CV_Error_( CV_StsNotImplemented,
("Unsupported combination of buffer format (=%d), and destination format (=%d)",
bufType, dstType));
return Ptr<BaseColumnFilter>(0);
return Ptr<BaseColumnFilter>();
}
@ -2933,7 +2933,7 @@ cv::Ptr<cv::FilterEngine> cv::createSeparableLinearFilter(
Ptr<BaseColumnFilter> _columnFilter = getLinearColumnFilter(
_bufType, _dstType, columnKernel, _anchor.y, ctype, _delta, bits );
return Ptr<FilterEngine>( new FilterEngine(Ptr<BaseFilter>(0), _rowFilter, _columnFilter,
return Ptr<FilterEngine>( new FilterEngine(Ptr<BaseFilter>(), _rowFilter, _columnFilter,
_srcType, _dstType, _bufType, _rowBorderType, _columnBorderType, _borderValue ));
}
@ -3085,13 +3085,13 @@ cv::Ptr<cv::BaseFilter> cv::getLinearFilter(int srcType, int dstType,
anchor = normalizeAnchor(anchor, _kernel.size());
/*if( sdepth == CV_8U && ddepth == CV_8U && kdepth == CV_32S )
return Ptr<BaseFilter>(new Filter2D<uchar, FixedPtCastEx<int, uchar>, FilterVec_8u>
return makePtr<Filter2D<uchar, FixedPtCastEx<int, uchar>, FilterVec_8u> >
(_kernel, anchor, delta, FixedPtCastEx<int, uchar>(bits),
FilterVec_8u(_kernel, bits, delta)));
FilterVec_8u(_kernel, bits, delta));
if( sdepth == CV_8U && ddepth == CV_16S && kdepth == CV_32S )
return Ptr<BaseFilter>(new Filter2D<uchar, FixedPtCastEx<int, short>, FilterVec_8u16s>
return makePtr<Filter2D<uchar, FixedPtCastEx<int, short>, FilterVec_8u16s> >
(_kernel, anchor, delta, FixedPtCastEx<int, short>(bits),
FilterVec_8u16s(_kernel, bits, delta)));*/
FilterVec_8u16s(_kernel, bits, delta));*/
kdepth = sdepth == CV_64F || ddepth == CV_64F ? CV_64F : CV_32F;
Mat kernel;
@ -3101,53 +3101,53 @@ cv::Ptr<cv::BaseFilter> cv::getLinearFilter(int srcType, int dstType,
_kernel.convertTo(kernel, kdepth, _kernel.type() == CV_32S ? 1./(1 << bits) : 1.);
if( sdepth == CV_8U && ddepth == CV_8U )
return Ptr<BaseFilter>(new Filter2D<uchar, Cast<float, uchar>, FilterVec_8u>
(kernel, anchor, delta, Cast<float, uchar>(), FilterVec_8u(kernel, 0, delta)));
return makePtr<Filter2D<uchar, Cast<float, uchar>, FilterVec_8u> >
(kernel, anchor, delta, Cast<float, uchar>(), FilterVec_8u(kernel, 0, delta));
if( sdepth == CV_8U && ddepth == CV_16U )
return Ptr<BaseFilter>(new Filter2D<uchar,
Cast<float, ushort>, FilterNoVec>(kernel, anchor, delta));
return makePtr<Filter2D<uchar,
Cast<float, ushort>, FilterNoVec> >(kernel, anchor, delta);
if( sdepth == CV_8U && ddepth == CV_16S )
return Ptr<BaseFilter>(new Filter2D<uchar, Cast<float, short>, FilterVec_8u16s>
(kernel, anchor, delta, Cast<float, short>(), FilterVec_8u16s(kernel, 0, delta)));
return makePtr<Filter2D<uchar, Cast<float, short>, FilterVec_8u16s> >
(kernel, anchor, delta, Cast<float, short>(), FilterVec_8u16s(kernel, 0, delta));
if( sdepth == CV_8U && ddepth == CV_32F )
return Ptr<BaseFilter>(new Filter2D<uchar,
Cast<float, float>, FilterNoVec>(kernel, anchor, delta));
return makePtr<Filter2D<uchar,
Cast<float, float>, FilterNoVec> >(kernel, anchor, delta);
if( sdepth == CV_8U && ddepth == CV_64F )
return Ptr<BaseFilter>(new Filter2D<uchar,
Cast<double, double>, FilterNoVec>(kernel, anchor, delta));
return makePtr<Filter2D<uchar,
Cast<double, double>, FilterNoVec> >(kernel, anchor, delta);
if( sdepth == CV_16U && ddepth == CV_16U )
return Ptr<BaseFilter>(new Filter2D<ushort,
Cast<float, ushort>, FilterNoVec>(kernel, anchor, delta));
return makePtr<Filter2D<ushort,
Cast<float, ushort>, FilterNoVec> >(kernel, anchor, delta);
if( sdepth == CV_16U && ddepth == CV_32F )
return Ptr<BaseFilter>(new Filter2D<ushort,
Cast<float, float>, FilterNoVec>(kernel, anchor, delta));
return makePtr<Filter2D<ushort,
Cast<float, float>, FilterNoVec> >(kernel, anchor, delta);
if( sdepth == CV_16U && ddepth == CV_64F )
return Ptr<BaseFilter>(new Filter2D<ushort,
Cast<double, double>, FilterNoVec>(kernel, anchor, delta));
return makePtr<Filter2D<ushort,
Cast<double, double>, FilterNoVec> >(kernel, anchor, delta);
if( sdepth == CV_16S && ddepth == CV_16S )
return Ptr<BaseFilter>(new Filter2D<short,
Cast<float, short>, FilterNoVec>(kernel, anchor, delta));
return makePtr<Filter2D<short,
Cast<float, short>, FilterNoVec> >(kernel, anchor, delta);
if( sdepth == CV_16S && ddepth == CV_32F )
return Ptr<BaseFilter>(new Filter2D<short,
Cast<float, float>, FilterNoVec>(kernel, anchor, delta));
return makePtr<Filter2D<short,
Cast<float, float>, FilterNoVec> >(kernel, anchor, delta);
if( sdepth == CV_16S && ddepth == CV_64F )
return Ptr<BaseFilter>(new Filter2D<short,
Cast<double, double>, FilterNoVec>(kernel, anchor, delta));
return makePtr<Filter2D<short,
Cast<double, double>, FilterNoVec> >(kernel, anchor, delta);
if( sdepth == CV_32F && ddepth == CV_32F )
return Ptr<BaseFilter>(new Filter2D<float, Cast<float, float>, FilterVec_32f>
(kernel, anchor, delta, Cast<float, float>(), FilterVec_32f(kernel, 0, delta)));
return makePtr<Filter2D<float, Cast<float, float>, FilterVec_32f> >
(kernel, anchor, delta, Cast<float, float>(), FilterVec_32f(kernel, 0, delta));
if( sdepth == CV_64F && ddepth == CV_64F )
return Ptr<BaseFilter>(new Filter2D<double,
Cast<double, double>, FilterNoVec>(kernel, anchor, delta));
return makePtr<Filter2D<double,
Cast<double, double>, FilterNoVec> >(kernel, anchor, delta);
CV_Error_( CV_StsNotImplemented,
("Unsupported combination of source format (=%d), and destination format (=%d)",
srcType, dstType));
return Ptr<BaseFilter>(0);
return Ptr<BaseFilter>();
}
@ -3178,9 +3178,9 @@ cv::Ptr<cv::FilterEngine> cv::createLinearFilter( int _srcType, int _dstType,
Ptr<BaseFilter> _filter2D = getLinearFilter(_srcType, _dstType,
kernel, _anchor, _delta, bits);
return Ptr<FilterEngine>(new FilterEngine(_filter2D, Ptr<BaseRowFilter>(0),
Ptr<BaseColumnFilter>(0), _srcType, _dstType, _srcType,
_rowBorderType, _columnBorderType, _borderValue ));
return makePtr<FilterEngine>(_filter2D, Ptr<BaseRowFilter>(),
Ptr<BaseColumnFilter>(), _srcType, _dstType, _srcType,
_rowBorderType, _columnBorderType, _borderValue );
}

View File

@ -491,7 +491,7 @@ namespace
Ptr<GeneralizedHoughBallard> cv::createGeneralizedHoughBallard()
{
return new GeneralizedHoughBallardImpl;
return makePtr<GeneralizedHoughBallardImpl>();
}
// GeneralizedHoughGuil
@ -940,5 +940,5 @@ namespace
Ptr<GeneralizedHoughGuil> cv::createGeneralizedHoughGuil()
{
return new GeneralizedHoughGuilImpl;
return makePtr<GeneralizedHoughGuilImpl>();
}

View File

@ -766,21 +766,21 @@ icvHoughCirclesGradient( CvMat* img, float dp, float min_dist,
float idp, dr;
CvSeqReader reader;
edges = cvCreateMat( img->rows, img->cols, CV_8UC1 );
edges.reset(cvCreateMat( img->rows, img->cols, CV_8UC1 ));
cvCanny( img, edges, MAX(canny_threshold/2,1), canny_threshold, 3 );
dx = cvCreateMat( img->rows, img->cols, CV_16SC1 );
dy = cvCreateMat( img->rows, img->cols, CV_16SC1 );
dx.reset(cvCreateMat( img->rows, img->cols, CV_16SC1 ));
dy.reset(cvCreateMat( img->rows, img->cols, CV_16SC1 ));
cvSobel( img, dx, 1, 0, 3 );
cvSobel( img, dy, 0, 1, 3 );
if( dp < 1.f )
dp = 1.f;
idp = 1.f/dp;
accum = cvCreateMat( cvCeil(img->rows*idp)+2, cvCeil(img->cols*idp)+2, CV_32SC1 );
accum.reset(cvCreateMat( cvCeil(img->rows*idp)+2, cvCeil(img->cols*idp)+2, CV_32SC1 ));
cvZero(accum);
storage = cvCreateMemStorage();
storage.reset(cvCreateMemStorage());
nz = cvCreateSeq( CV_32SC2, sizeof(CvSeq), sizeof(CvPoint), storage );
centers = cvCreateSeq( CV_32SC1, sizeof(CvSeq), sizeof(int), storage );
@ -866,7 +866,7 @@ icvHoughCirclesGradient( CvMat* img, float dp, float min_dist,
cvClearSeq( centers );
cvSeqPushMulti( centers, &sort_buf[0], center_count );
dist_buf = cvCreateMat( 1, nz_count, CV_32FC1 );
dist_buf.reset(cvCreateMat( 1, nz_count, CV_32FC1 ));
ddata = dist_buf->data.fl;
dr = dp;
@ -1060,7 +1060,7 @@ void cv::HoughCircles( InputArray _image, OutputArray _circles,
double param1, double param2,
int minRadius, int maxRadius )
{
Ptr<CvMemStorage> storage = cvCreateMemStorage(STORAGE_SIZE);
Ptr<CvMemStorage> storage(cvCreateMemStorage(STORAGE_SIZE));
Mat image = _image.getMat();
CvMat c_image = image;
CvSeq* seq = cvHoughCircles( &c_image, storage, method,

View File

@ -3931,8 +3931,8 @@ cvLogPolar( const CvArr* srcarr, CvArr* dstarr,
ssize = cvGetMatSize(src);
dsize = cvGetMatSize(dst);
mapx = cvCreateMat( dsize.height, dsize.width, CV_32F );
mapy = cvCreateMat( dsize.height, dsize.width, CV_32F );
mapx.reset(cvCreateMat( dsize.height, dsize.width, CV_32F ));
mapy.reset(cvCreateMat( dsize.height, dsize.width, CV_32F ));
if( !(flags & CV_WARP_INVERSE_MAP) )
{
@ -4049,8 +4049,8 @@ void cvLinearPolar( const CvArr* srcarr, CvArr* dstarr,
dsize.width = dst->cols;
dsize.height = dst->rows;
mapx = cvCreateMat( dsize.height, dsize.width, CV_32F );
mapy = cvCreateMat( dsize.height, dsize.width, CV_32F );
mapx.reset(cvCreateMat( dsize.height, dsize.width, CV_32F ));
mapy.reset(cvCreateMat( dsize.height, dsize.width, CV_32F ));
if( !(flags & CV_WARP_INVERSE_MAP) )
{

View File

@ -393,9 +393,9 @@ CV_EXPORTS Ptr<LineSegmentDetector> createLineSegmentDetectorPtr(
int _refine, double _scale, double _sigma_scale, double _quant, double _ang_th,
double _log_eps, double _density_th, int _n_bins)
{
return Ptr<LineSegmentDetector>(new LineSegmentDetectorImpl(
return makePtr<LineSegmentDetectorImpl>(
_refine, _scale, _sigma_scale, _quant, _ang_th,
_log_eps, _density_th, _n_bins));
_log_eps, _density_th, _n_bins);
}
/////////////////////////////////////////////////////////////////////////////////////////

View File

@ -857,42 +857,42 @@ cv::Ptr<cv::BaseRowFilter> cv::getMorphologyRowFilter(int op, int type, int ksiz
if( op == MORPH_ERODE )
{
if( depth == CV_8U )
return Ptr<BaseRowFilter>(new MorphRowFilter<MinOp<uchar>,
ErodeRowVec8u>(ksize, anchor));
return makePtr<MorphRowFilter<MinOp<uchar>,
ErodeRowVec8u> >(ksize, anchor);
if( depth == CV_16U )
return Ptr<BaseRowFilter>(new MorphRowFilter<MinOp<ushort>,
ErodeRowVec16u>(ksize, anchor));
return makePtr<MorphRowFilter<MinOp<ushort>,
ErodeRowVec16u> >(ksize, anchor);
if( depth == CV_16S )
return Ptr<BaseRowFilter>(new MorphRowFilter<MinOp<short>,
ErodeRowVec16s>(ksize, anchor));
return makePtr<MorphRowFilter<MinOp<short>,
ErodeRowVec16s> >(ksize, anchor);
if( depth == CV_32F )
return Ptr<BaseRowFilter>(new MorphRowFilter<MinOp<float>,
ErodeRowVec32f>(ksize, anchor));
return makePtr<MorphRowFilter<MinOp<float>,
ErodeRowVec32f> >(ksize, anchor);
if( depth == CV_64F )
return Ptr<BaseRowFilter>(new MorphRowFilter<MinOp<double>,
ErodeRowVec64f>(ksize, anchor));
return makePtr<MorphRowFilter<MinOp<double>,
ErodeRowVec64f> >(ksize, anchor);
}
else
{
if( depth == CV_8U )
return Ptr<BaseRowFilter>(new MorphRowFilter<MaxOp<uchar>,
DilateRowVec8u>(ksize, anchor));
return makePtr<MorphRowFilter<MaxOp<uchar>,
DilateRowVec8u> >(ksize, anchor);
if( depth == CV_16U )
return Ptr<BaseRowFilter>(new MorphRowFilter<MaxOp<ushort>,
DilateRowVec16u>(ksize, anchor));
return makePtr<MorphRowFilter<MaxOp<ushort>,
DilateRowVec16u> >(ksize, anchor);
if( depth == CV_16S )
return Ptr<BaseRowFilter>(new MorphRowFilter<MaxOp<short>,
DilateRowVec16s>(ksize, anchor));
return makePtr<MorphRowFilter<MaxOp<short>,
DilateRowVec16s> >(ksize, anchor);
if( depth == CV_32F )
return Ptr<BaseRowFilter>(new MorphRowFilter<MaxOp<float>,
DilateRowVec32f>(ksize, anchor));
return makePtr<MorphRowFilter<MaxOp<float>,
DilateRowVec32f> >(ksize, anchor);
if( depth == CV_64F )
return Ptr<BaseRowFilter>(new MorphRowFilter<MaxOp<double>,
DilateRowVec64f>(ksize, anchor));
return makePtr<MorphRowFilter<MaxOp<double>,
DilateRowVec64f> >(ksize, anchor);
}
CV_Error_( CV_StsNotImplemented, ("Unsupported data type (=%d)", type));
return Ptr<BaseRowFilter>(0);
return Ptr<BaseRowFilter>();
}
cv::Ptr<cv::BaseColumnFilter> cv::getMorphologyColumnFilter(int op, int type, int ksize, int anchor)
@ -904,42 +904,42 @@ cv::Ptr<cv::BaseColumnFilter> cv::getMorphologyColumnFilter(int op, int type, in
if( op == MORPH_ERODE )
{
if( depth == CV_8U )
return Ptr<BaseColumnFilter>(new MorphColumnFilter<MinOp<uchar>,
ErodeColumnVec8u>(ksize, anchor));
return makePtr<MorphColumnFilter<MinOp<uchar>,
ErodeColumnVec8u> >(ksize, anchor);
if( depth == CV_16U )
return Ptr<BaseColumnFilter>(new MorphColumnFilter<MinOp<ushort>,
ErodeColumnVec16u>(ksize, anchor));
return makePtr<MorphColumnFilter<MinOp<ushort>,
ErodeColumnVec16u> >(ksize, anchor);
if( depth == CV_16S )
return Ptr<BaseColumnFilter>(new MorphColumnFilter<MinOp<short>,
ErodeColumnVec16s>(ksize, anchor));
return makePtr<MorphColumnFilter<MinOp<short>,
ErodeColumnVec16s> >(ksize, anchor);
if( depth == CV_32F )
return Ptr<BaseColumnFilter>(new MorphColumnFilter<MinOp<float>,
ErodeColumnVec32f>(ksize, anchor));
return makePtr<MorphColumnFilter<MinOp<float>,
ErodeColumnVec32f> >(ksize, anchor);
if( depth == CV_64F )
return Ptr<BaseColumnFilter>(new MorphColumnFilter<MinOp<double>,
ErodeColumnVec64f>(ksize, anchor));
return makePtr<MorphColumnFilter<MinOp<double>,
ErodeColumnVec64f> >(ksize, anchor);
}
else
{
if( depth == CV_8U )
return Ptr<BaseColumnFilter>(new MorphColumnFilter<MaxOp<uchar>,
DilateColumnVec8u>(ksize, anchor));
return makePtr<MorphColumnFilter<MaxOp<uchar>,
DilateColumnVec8u> >(ksize, anchor);
if( depth == CV_16U )
return Ptr<BaseColumnFilter>(new MorphColumnFilter<MaxOp<ushort>,
DilateColumnVec16u>(ksize, anchor));
return makePtr<MorphColumnFilter<MaxOp<ushort>,
DilateColumnVec16u> >(ksize, anchor);
if( depth == CV_16S )
return Ptr<BaseColumnFilter>(new MorphColumnFilter<MaxOp<short>,
DilateColumnVec16s>(ksize, anchor));
return makePtr<MorphColumnFilter<MaxOp<short>,
DilateColumnVec16s> >(ksize, anchor);
if( depth == CV_32F )
return Ptr<BaseColumnFilter>(new MorphColumnFilter<MaxOp<float>,
DilateColumnVec32f>(ksize, anchor));
return makePtr<MorphColumnFilter<MaxOp<float>,
DilateColumnVec32f> >(ksize, anchor);
if( depth == CV_64F )
return Ptr<BaseColumnFilter>(new MorphColumnFilter<MaxOp<double>,
DilateColumnVec64f>(ksize, anchor));
return makePtr<MorphColumnFilter<MaxOp<double>,
DilateColumnVec64f> >(ksize, anchor);
}
CV_Error_( CV_StsNotImplemented, ("Unsupported data type (=%d)", type));
return Ptr<BaseColumnFilter>(0);
return Ptr<BaseColumnFilter>();
}
@ -952,32 +952,32 @@ cv::Ptr<cv::BaseFilter> cv::getMorphologyFilter(int op, int type, InputArray _ke
if( op == MORPH_ERODE )
{
if( depth == CV_8U )
return Ptr<BaseFilter>(new MorphFilter<MinOp<uchar>, ErodeVec8u>(kernel, anchor));
return makePtr<MorphFilter<MinOp<uchar>, ErodeVec8u> >(kernel, anchor);
if( depth == CV_16U )
return Ptr<BaseFilter>(new MorphFilter<MinOp<ushort>, ErodeVec16u>(kernel, anchor));
return makePtr<MorphFilter<MinOp<ushort>, ErodeVec16u> >(kernel, anchor);
if( depth == CV_16S )
return Ptr<BaseFilter>(new MorphFilter<MinOp<short>, ErodeVec16s>(kernel, anchor));
return makePtr<MorphFilter<MinOp<short>, ErodeVec16s> >(kernel, anchor);
if( depth == CV_32F )
return Ptr<BaseFilter>(new MorphFilter<MinOp<float>, ErodeVec32f>(kernel, anchor));
return makePtr<MorphFilter<MinOp<float>, ErodeVec32f> >(kernel, anchor);
if( depth == CV_64F )
return Ptr<BaseFilter>(new MorphFilter<MinOp<double>, ErodeVec64f>(kernel, anchor));
return makePtr<MorphFilter<MinOp<double>, ErodeVec64f> >(kernel, anchor);
}
else
{
if( depth == CV_8U )
return Ptr<BaseFilter>(new MorphFilter<MaxOp<uchar>, DilateVec8u>(kernel, anchor));
return makePtr<MorphFilter<MaxOp<uchar>, DilateVec8u> >(kernel, anchor);
if( depth == CV_16U )
return Ptr<BaseFilter>(new MorphFilter<MaxOp<ushort>, DilateVec16u>(kernel, anchor));
return makePtr<MorphFilter<MaxOp<ushort>, DilateVec16u> >(kernel, anchor);
if( depth == CV_16S )
return Ptr<BaseFilter>(new MorphFilter<MaxOp<short>, DilateVec16s>(kernel, anchor));
return makePtr<MorphFilter<MaxOp<short>, DilateVec16s> >(kernel, anchor);
if( depth == CV_32F )
return Ptr<BaseFilter>(new MorphFilter<MaxOp<float>, DilateVec32f>(kernel, anchor));
return makePtr<MorphFilter<MaxOp<float>, DilateVec32f> >(kernel, anchor);
if( depth == CV_64F )
return Ptr<BaseFilter>(new MorphFilter<MaxOp<double>, DilateVec64f>(kernel, anchor));
return makePtr<MorphFilter<MaxOp<double>, DilateVec64f> >(kernel, anchor);
}
CV_Error_( CV_StsNotImplemented, ("Unsupported data type (=%d)", type));
return Ptr<BaseFilter>(0);
return Ptr<BaseFilter>();
}
@ -1020,8 +1020,8 @@ cv::Ptr<cv::FilterEngine> cv::createMorphologyFilter( int op, int type, InputArr
depth == CV_32F ? (double)-FLT_MAX : -DBL_MAX);
}
return Ptr<FilterEngine>(new FilterEngine(filter2D, rowFilter, columnFilter,
type, type, type, _rowBorderType, _columnBorderType, borderValue ));
return makePtr<FilterEngine>(filter2D, rowFilter, columnFilter,
type, type, type, _rowBorderType, _columnBorderType, borderValue );
}

View File

@ -622,29 +622,29 @@ cv::Ptr<cv::BaseRowFilter> cv::getRowSumFilter(int srcType, int sumType, int ksi
anchor = ksize/2;
if( sdepth == CV_8U && ddepth == CV_32S )
return Ptr<BaseRowFilter>(new RowSum<uchar, int>(ksize, anchor));
return makePtr<RowSum<uchar, int> >(ksize, anchor);
if( sdepth == CV_8U && ddepth == CV_64F )
return Ptr<BaseRowFilter>(new RowSum<uchar, double>(ksize, anchor));
return makePtr<RowSum<uchar, double> >(ksize, anchor);
if( sdepth == CV_16U && ddepth == CV_32S )
return Ptr<BaseRowFilter>(new RowSum<ushort, int>(ksize, anchor));
return makePtr<RowSum<ushort, int> >(ksize, anchor);
if( sdepth == CV_16U && ddepth == CV_64F )
return Ptr<BaseRowFilter>(new RowSum<ushort, double>(ksize, anchor));
return makePtr<RowSum<ushort, double> >(ksize, anchor);
if( sdepth == CV_16S && ddepth == CV_32S )
return Ptr<BaseRowFilter>(new RowSum<short, int>(ksize, anchor));
return makePtr<RowSum<short, int> >(ksize, anchor);
if( sdepth == CV_32S && ddepth == CV_32S )
return Ptr<BaseRowFilter>(new RowSum<int, int>(ksize, anchor));
return makePtr<RowSum<int, int> >(ksize, anchor);
if( sdepth == CV_16S && ddepth == CV_64F )
return Ptr<BaseRowFilter>(new RowSum<short, double>(ksize, anchor));
return makePtr<RowSum<short, double> >(ksize, anchor);
if( sdepth == CV_32F && ddepth == CV_64F )
return Ptr<BaseRowFilter>(new RowSum<float, double>(ksize, anchor));
return makePtr<RowSum<float, double> >(ksize, anchor);
if( sdepth == CV_64F && ddepth == CV_64F )
return Ptr<BaseRowFilter>(new RowSum<double, double>(ksize, anchor));
return makePtr<RowSum<double, double> >(ksize, anchor);
CV_Error_( CV_StsNotImplemented,
("Unsupported combination of source format (=%d), and buffer format (=%d)",
srcType, sumType));
return Ptr<BaseRowFilter>(0);
return Ptr<BaseRowFilter>();
}
@ -658,33 +658,33 @@ cv::Ptr<cv::BaseColumnFilter> cv::getColumnSumFilter(int sumType, int dstType, i
anchor = ksize/2;
if( ddepth == CV_8U && sdepth == CV_32S )
return Ptr<BaseColumnFilter>(new ColumnSum<int, uchar>(ksize, anchor, scale));
return makePtr<ColumnSum<int, uchar> >(ksize, anchor, scale);
if( ddepth == CV_8U && sdepth == CV_64F )
return Ptr<BaseColumnFilter>(new ColumnSum<double, uchar>(ksize, anchor, scale));
return makePtr<ColumnSum<double, uchar> >(ksize, anchor, scale);
if( ddepth == CV_16U && sdepth == CV_32S )
return Ptr<BaseColumnFilter>(new ColumnSum<int, ushort>(ksize, anchor, scale));
return makePtr<ColumnSum<int, ushort> >(ksize, anchor, scale);
if( ddepth == CV_16U && sdepth == CV_64F )
return Ptr<BaseColumnFilter>(new ColumnSum<double, ushort>(ksize, anchor, scale));
return makePtr<ColumnSum<double, ushort> >(ksize, anchor, scale);
if( ddepth == CV_16S && sdepth == CV_32S )
return Ptr<BaseColumnFilter>(new ColumnSum<int, short>(ksize, anchor, scale));
return makePtr<ColumnSum<int, short> >(ksize, anchor, scale);
if( ddepth == CV_16S && sdepth == CV_64F )
return Ptr<BaseColumnFilter>(new ColumnSum<double, short>(ksize, anchor, scale));
return makePtr<ColumnSum<double, short> >(ksize, anchor, scale);
if( ddepth == CV_32S && sdepth == CV_32S )
return Ptr<BaseColumnFilter>(new ColumnSum<int, int>(ksize, anchor, scale));
return makePtr<ColumnSum<int, int> >(ksize, anchor, scale);
if( ddepth == CV_32F && sdepth == CV_32S )
return Ptr<BaseColumnFilter>(new ColumnSum<int, float>(ksize, anchor, scale));
return makePtr<ColumnSum<int, float> >(ksize, anchor, scale);
if( ddepth == CV_32F && sdepth == CV_64F )
return Ptr<BaseColumnFilter>(new ColumnSum<double, float>(ksize, anchor, scale));
return makePtr<ColumnSum<double, float> >(ksize, anchor, scale);
if( ddepth == CV_64F && sdepth == CV_32S )
return Ptr<BaseColumnFilter>(new ColumnSum<int, double>(ksize, anchor, scale));
return makePtr<ColumnSum<int, double> >(ksize, anchor, scale);
if( ddepth == CV_64F && sdepth == CV_64F )
return Ptr<BaseColumnFilter>(new ColumnSum<double, double>(ksize, anchor, scale));
return makePtr<ColumnSum<double, double> >(ksize, anchor, scale);
CV_Error_( CV_StsNotImplemented,
("Unsupported combination of sum format (=%d), and destination format (=%d)",
sumType, dstType));
return Ptr<BaseColumnFilter>(0);
return Ptr<BaseColumnFilter>();
}
@ -703,8 +703,8 @@ cv::Ptr<cv::FilterEngine> cv::createBoxFilter( int srcType, int dstType, Size ks
Ptr<BaseColumnFilter> columnFilter = getColumnSumFilter(sumType,
dstType, ksize.height, anchor.y, normalize ? 1./(ksize.width*ksize.height) : 1);
return Ptr<FilterEngine>(new FilterEngine(Ptr<BaseFilter>(0), rowFilter, columnFilter,
srcType, dstType, sumType, borderType ));
return makePtr<FilterEngine>(Ptr<BaseFilter>(), rowFilter, columnFilter,
srcType, dstType, sumType, borderType );
}

View File

@ -1626,7 +1626,7 @@ CV_PerimeterAreaSliceTest::~CV_PerimeterAreaSliceTest() {}
void CV_PerimeterAreaSliceTest::run( int )
{
Ptr<CvMemStorage> storage = cvCreateMemStorage();
Ptr<CvMemStorage> storage(cvCreateMemStorage());
RNG& rng = theRNG();
const double min_r = 90, max_r = 120;