mirror of
https://github.com/opencv/opencv.git
synced 2024-11-24 03:00:14 +08:00
C-API cleanup: use AutoBuffer in MSER
This commit is contained in:
parent
658336b366
commit
72023951ea
@ -873,10 +873,13 @@ extractMSER_8uC3( const Mat& src,
|
|||||||
const MSER_Impl::Params& params )
|
const MSER_Impl::Params& params )
|
||||||
{
|
{
|
||||||
bboxvec.clear();
|
bboxvec.clear();
|
||||||
MSCRNode* map = (MSCRNode*)cvAlloc( src.cols*src.rows*sizeof(map[0]) );
|
AutoBuffer<MSCRNode> mapBuf(src.cols*src.rows);
|
||||||
|
MSCRNode* map = mapBuf.data();
|
||||||
int Ne = src.cols*src.rows*2-src.cols-src.rows;
|
int Ne = src.cols*src.rows*2-src.cols-src.rows;
|
||||||
MSCREdge* edge = (MSCREdge*)cvAlloc( Ne*sizeof(edge[0]) );
|
AutoBuffer<MSCREdge> edgeBuf(Ne);
|
||||||
TempMSCR* mscr = (TempMSCR*)cvAlloc( src.cols*src.rows*sizeof(mscr[0]) );
|
MSCREdge* edge = edgeBuf.data();
|
||||||
|
AutoBuffer<TempMSCR> mscrBuf(src.cols*src.rows);
|
||||||
|
TempMSCR* mscr = mscrBuf.data();
|
||||||
double emean = 0;
|
double emean = 0;
|
||||||
Mat dx( src.rows, src.cols-1, CV_64FC1 );
|
Mat dx( src.rows, src.cols-1, CV_64FC1 );
|
||||||
Mat dy( src.rows-1, src.cols, CV_64FC1 );
|
Mat dy( src.rows-1, src.cols, CV_64FC1 );
|
||||||
@ -987,9 +990,6 @@ extractMSER_8uC3( const Mat& src,
|
|||||||
}
|
}
|
||||||
bboxvec.push_back(Rect(xmin, ymin, xmax - xmin + 1, ymax - ymin + 1));
|
bboxvec.push_back(Rect(xmin, ymin, xmax - xmin + 1, ymax - ymin + 1));
|
||||||
}
|
}
|
||||||
cvFree( &mscr );
|
|
||||||
cvFree( &edge );
|
|
||||||
cvFree( &map );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MSER_Impl::detectRegions( InputArray _src, vector<vector<Point> >& msers, vector<Rect>& bboxes )
|
void MSER_Impl::detectRegions( InputArray _src, vector<vector<Point> >& msers, vector<Rect>& bboxes )
|
||||||
|
Loading…
Reference in New Issue
Block a user