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), Point dstOfs = Point(0,0),
bool isolated = false); bool isolated = false);
//! returns true if the filter is separable //! returns true if the filter is separable
bool isSeparable() const { return (const BaseFilter*)filter2D == 0; } bool isSeparable() const { return !filter2D; }
//! returns the number //! returns the number
int remainingInputRows() const; int remainingInputRows() const;
int remainingOutputRows() const; int remainingOutputRows() const;

View File

@ -330,5 +330,5 @@ namespace
cv::Ptr<cv::CLAHE> cv::createCLAHE(double clipLimit, cv::Size tileGridSize) 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)) if( contourHeaderSize < (int)sizeof(CvContour))
CV_Error( CV_StsBadSize, "Contour header size must be >= sizeof(CvContour)" ); CV_Error( CV_StsBadSize, "Contour header size must be >= sizeof(CvContour)" );
storage00 = cvCreateChildMemStorage(storage); storage00.reset(cvCreateChildMemStorage(storage));
storage01 = cvCreateChildMemStorage(storage); storage01.reset(cvCreateChildMemStorage(storage));
CvMat stub, *mat; CvMat stub, *mat;

View File

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

View File

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

View File

@ -3931,8 +3931,8 @@ cvLogPolar( const CvArr* srcarr, CvArr* dstarr,
ssize = cvGetMatSize(src); ssize = cvGetMatSize(src);
dsize = cvGetMatSize(dst); dsize = cvGetMatSize(dst);
mapx = cvCreateMat( dsize.height, dsize.width, CV_32F ); mapx.reset(cvCreateMat( dsize.height, dsize.width, CV_32F ));
mapy = cvCreateMat( dsize.height, dsize.width, CV_32F ); mapy.reset(cvCreateMat( dsize.height, dsize.width, CV_32F ));
if( !(flags & CV_WARP_INVERSE_MAP) ) if( !(flags & CV_WARP_INVERSE_MAP) )
{ {
@ -4049,8 +4049,8 @@ void cvLinearPolar( const CvArr* srcarr, CvArr* dstarr,
dsize.width = dst->cols; dsize.width = dst->cols;
dsize.height = dst->rows; dsize.height = dst->rows;
mapx = cvCreateMat( dsize.height, dsize.width, CV_32F ); mapx.reset(cvCreateMat( dsize.height, dsize.width, CV_32F ));
mapy = cvCreateMat( dsize.height, dsize.width, CV_32F ); mapy.reset(cvCreateMat( dsize.height, dsize.width, CV_32F ));
if( !(flags & CV_WARP_INVERSE_MAP) ) 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, int _refine, double _scale, double _sigma_scale, double _quant, double _ang_th,
double _log_eps, double _density_th, int _n_bins) double _log_eps, double _density_th, int _n_bins)
{ {
return Ptr<LineSegmentDetector>(new LineSegmentDetectorImpl( return makePtr<LineSegmentDetectorImpl>(
_refine, _scale, _sigma_scale, _quant, _ang_th, _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( op == MORPH_ERODE )
{ {
if( depth == CV_8U ) if( depth == CV_8U )
return Ptr<BaseRowFilter>(new MorphRowFilter<MinOp<uchar>, return makePtr<MorphRowFilter<MinOp<uchar>,
ErodeRowVec8u>(ksize, anchor)); ErodeRowVec8u> >(ksize, anchor);
if( depth == CV_16U ) if( depth == CV_16U )
return Ptr<BaseRowFilter>(new MorphRowFilter<MinOp<ushort>, return makePtr<MorphRowFilter<MinOp<ushort>,
ErodeRowVec16u>(ksize, anchor)); ErodeRowVec16u> >(ksize, anchor);
if( depth == CV_16S ) if( depth == CV_16S )
return Ptr<BaseRowFilter>(new MorphRowFilter<MinOp<short>, return makePtr<MorphRowFilter<MinOp<short>,
ErodeRowVec16s>(ksize, anchor)); ErodeRowVec16s> >(ksize, anchor);
if( depth == CV_32F ) if( depth == CV_32F )
return Ptr<BaseRowFilter>(new MorphRowFilter<MinOp<float>, return makePtr<MorphRowFilter<MinOp<float>,
ErodeRowVec32f>(ksize, anchor)); ErodeRowVec32f> >(ksize, anchor);
if( depth == CV_64F ) if( depth == CV_64F )
return Ptr<BaseRowFilter>(new MorphRowFilter<MinOp<double>, return makePtr<MorphRowFilter<MinOp<double>,
ErodeRowVec64f>(ksize, anchor)); ErodeRowVec64f> >(ksize, anchor);
} }
else else
{ {
if( depth == CV_8U ) if( depth == CV_8U )
return Ptr<BaseRowFilter>(new MorphRowFilter<MaxOp<uchar>, return makePtr<MorphRowFilter<MaxOp<uchar>,
DilateRowVec8u>(ksize, anchor)); DilateRowVec8u> >(ksize, anchor);
if( depth == CV_16U ) if( depth == CV_16U )
return Ptr<BaseRowFilter>(new MorphRowFilter<MaxOp<ushort>, return makePtr<MorphRowFilter<MaxOp<ushort>,
DilateRowVec16u>(ksize, anchor)); DilateRowVec16u> >(ksize, anchor);
if( depth == CV_16S ) if( depth == CV_16S )
return Ptr<BaseRowFilter>(new MorphRowFilter<MaxOp<short>, return makePtr<MorphRowFilter<MaxOp<short>,
DilateRowVec16s>(ksize, anchor)); DilateRowVec16s> >(ksize, anchor);
if( depth == CV_32F ) if( depth == CV_32F )
return Ptr<BaseRowFilter>(new MorphRowFilter<MaxOp<float>, return makePtr<MorphRowFilter<MaxOp<float>,
DilateRowVec32f>(ksize, anchor)); DilateRowVec32f> >(ksize, anchor);
if( depth == CV_64F ) if( depth == CV_64F )
return Ptr<BaseRowFilter>(new MorphRowFilter<MaxOp<double>, return makePtr<MorphRowFilter<MaxOp<double>,
DilateRowVec64f>(ksize, anchor)); DilateRowVec64f> >(ksize, anchor);
} }
CV_Error_( CV_StsNotImplemented, ("Unsupported data type (=%d)", type)); 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) 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( op == MORPH_ERODE )
{ {
if( depth == CV_8U ) if( depth == CV_8U )
return Ptr<BaseColumnFilter>(new MorphColumnFilter<MinOp<uchar>, return makePtr<MorphColumnFilter<MinOp<uchar>,
ErodeColumnVec8u>(ksize, anchor)); ErodeColumnVec8u> >(ksize, anchor);
if( depth == CV_16U ) if( depth == CV_16U )
return Ptr<BaseColumnFilter>(new MorphColumnFilter<MinOp<ushort>, return makePtr<MorphColumnFilter<MinOp<ushort>,
ErodeColumnVec16u>(ksize, anchor)); ErodeColumnVec16u> >(ksize, anchor);
if( depth == CV_16S ) if( depth == CV_16S )
return Ptr<BaseColumnFilter>(new MorphColumnFilter<MinOp<short>, return makePtr<MorphColumnFilter<MinOp<short>,
ErodeColumnVec16s>(ksize, anchor)); ErodeColumnVec16s> >(ksize, anchor);
if( depth == CV_32F ) if( depth == CV_32F )
return Ptr<BaseColumnFilter>(new MorphColumnFilter<MinOp<float>, return makePtr<MorphColumnFilter<MinOp<float>,
ErodeColumnVec32f>(ksize, anchor)); ErodeColumnVec32f> >(ksize, anchor);
if( depth == CV_64F ) if( depth == CV_64F )
return Ptr<BaseColumnFilter>(new MorphColumnFilter<MinOp<double>, return makePtr<MorphColumnFilter<MinOp<double>,
ErodeColumnVec64f>(ksize, anchor)); ErodeColumnVec64f> >(ksize, anchor);
} }
else else
{ {
if( depth == CV_8U ) if( depth == CV_8U )
return Ptr<BaseColumnFilter>(new MorphColumnFilter<MaxOp<uchar>, return makePtr<MorphColumnFilter<MaxOp<uchar>,
DilateColumnVec8u>(ksize, anchor)); DilateColumnVec8u> >(ksize, anchor);
if( depth == CV_16U ) if( depth == CV_16U )
return Ptr<BaseColumnFilter>(new MorphColumnFilter<MaxOp<ushort>, return makePtr<MorphColumnFilter<MaxOp<ushort>,
DilateColumnVec16u>(ksize, anchor)); DilateColumnVec16u> >(ksize, anchor);
if( depth == CV_16S ) if( depth == CV_16S )
return Ptr<BaseColumnFilter>(new MorphColumnFilter<MaxOp<short>, return makePtr<MorphColumnFilter<MaxOp<short>,
DilateColumnVec16s>(ksize, anchor)); DilateColumnVec16s> >(ksize, anchor);
if( depth == CV_32F ) if( depth == CV_32F )
return Ptr<BaseColumnFilter>(new MorphColumnFilter<MaxOp<float>, return makePtr<MorphColumnFilter<MaxOp<float>,
DilateColumnVec32f>(ksize, anchor)); DilateColumnVec32f> >(ksize, anchor);
if( depth == CV_64F ) if( depth == CV_64F )
return Ptr<BaseColumnFilter>(new MorphColumnFilter<MaxOp<double>, return makePtr<MorphColumnFilter<MaxOp<double>,
DilateColumnVec64f>(ksize, anchor)); DilateColumnVec64f> >(ksize, anchor);
} }
CV_Error_( CV_StsNotImplemented, ("Unsupported data type (=%d)", type)); 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( op == MORPH_ERODE )
{ {
if( depth == CV_8U ) 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 ) 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 ) 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 ) 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 ) if( depth == CV_64F )
return Ptr<BaseFilter>(new MorphFilter<MinOp<double>, ErodeVec64f>(kernel, anchor)); return makePtr<MorphFilter<MinOp<double>, ErodeVec64f> >(kernel, anchor);
} }
else else
{ {
if( depth == CV_8U ) 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 ) 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 ) 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 ) 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 ) 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)); 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); depth == CV_32F ? (double)-FLT_MAX : -DBL_MAX);
} }
return Ptr<FilterEngine>(new FilterEngine(filter2D, rowFilter, columnFilter, return makePtr<FilterEngine>(filter2D, rowFilter, columnFilter,
type, type, type, _rowBorderType, _columnBorderType, borderValue )); 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; anchor = ksize/2;
if( sdepth == CV_8U && ddepth == CV_32S ) 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 ) 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 ) 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 ) 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 ) 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 ) 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 ) 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 ) 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 ) 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, CV_Error_( CV_StsNotImplemented,
("Unsupported combination of source format (=%d), and buffer format (=%d)", ("Unsupported combination of source format (=%d), and buffer format (=%d)",
srcType, sumType)); 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; anchor = ksize/2;
if( ddepth == CV_8U && sdepth == CV_32S ) 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 ) 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 ) 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 ) 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 ) 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 ) 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 ) 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 ) 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 ) 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 ) 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 ) 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, CV_Error_( CV_StsNotImplemented,
("Unsupported combination of sum format (=%d), and destination format (=%d)", ("Unsupported combination of sum format (=%d), and destination format (=%d)",
sumType, dstType)); 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, Ptr<BaseColumnFilter> columnFilter = getColumnSumFilter(sumType,
dstType, ksize.height, anchor.y, normalize ? 1./(ksize.width*ksize.height) : 1); dstType, ksize.height, anchor.y, normalize ? 1./(ksize.width*ksize.height) : 1);
return Ptr<FilterEngine>(new FilterEngine(Ptr<BaseFilter>(0), rowFilter, columnFilter, return makePtr<FilterEngine>(Ptr<BaseFilter>(), rowFilter, columnFilter,
srcType, dstType, sumType, borderType )); srcType, dstType, sumType, borderType );
} }

View File

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