fixed bug with possible memory corruption in CvMat m = iarray.getMat(); expressions (ticket #1054)
This commit is contained in:
@@ -261,7 +261,8 @@ void cv::cornerSubPix( const InputArray& _image, InputOutputArray _corners,
|
||||
Mat corners = _corners.getMat();
|
||||
int ncorners = corners.checkVector(2);
|
||||
CV_Assert( ncorners >= 0 && corners.depth() == CV_32F );
|
||||
CvMat c_image = _image.getMat();
|
||||
Mat image = _image.getMat();
|
||||
CvMat c_image = image;
|
||||
|
||||
cvFindCornerSubPix( &c_image, (CvPoint2D32f*)corners.data, ncorners,
|
||||
winSize, zeroZone, criteria );
|
||||
|
||||
@@ -1109,7 +1109,8 @@ void cv::HoughLines( const InputArray& _image, OutputArray _lines,
|
||||
double srn, double stn )
|
||||
{
|
||||
Ptr<CvMemStorage> storage = cvCreateMemStorage(STORAGE_SIZE);
|
||||
CvMat c_image = _image.getMat();
|
||||
Mat image = _image.getMat();
|
||||
CvMat c_image = image;
|
||||
CvSeq* seq = cvHoughLines2( &c_image, storage, srn == 0 && stn == 0 ?
|
||||
CV_HOUGH_STANDARD : CV_HOUGH_MULTI_SCALE,
|
||||
rho, theta, threshold, srn, stn );
|
||||
@@ -1121,7 +1122,8 @@ void cv::HoughLinesP( const InputArray& _image, OutputArray _lines,
|
||||
double minLineLength, double maxGap )
|
||||
{
|
||||
Ptr<CvMemStorage> storage = cvCreateMemStorage(STORAGE_SIZE);
|
||||
CvMat c_image = _image.getMat();
|
||||
Mat image = _image.getMat();
|
||||
CvMat c_image = image;
|
||||
CvSeq* seq = cvHoughLines2( &c_image, storage, CV_HOUGH_PROBABILISTIC,
|
||||
rho, theta, threshold, minLineLength, maxGap );
|
||||
seqToMat(seq, _lines);
|
||||
@@ -1133,7 +1135,8 @@ void cv::HoughCircles( const InputArray& _image, OutputArray _circles,
|
||||
int minRadius, int maxRadius )
|
||||
{
|
||||
Ptr<CvMemStorage> storage = cvCreateMemStorage(STORAGE_SIZE);
|
||||
CvMat c_image = _image.getMat();
|
||||
Mat image = _image.getMat();
|
||||
CvMat c_image = image;
|
||||
CvSeq* seq = cvHoughCircles( &c_image, storage, method,
|
||||
dp, min_dist, param1, param2, minRadius, maxRadius );
|
||||
seqToMat(seq, _circles);
|
||||
|
||||
@@ -810,8 +810,8 @@ cvInpaint( const CvArr* _input_img, const CvArr* _inpaint_mask, CvArr* _output_i
|
||||
void cv::inpaint( const InputArray& _src, const InputArray& _mask, OutputArray _dst,
|
||||
double inpaintRange, int flags )
|
||||
{
|
||||
Mat src = _src.getMat();
|
||||
Mat src = _src.getMat(), mask = _mask.getMat();
|
||||
_dst.create( src.size(), src.type() );
|
||||
CvMat c_src = src, c_mask = _mask.getMat(), c_dst = _dst.getMat();
|
||||
CvMat c_src = src, c_mask = mask, c_dst = _dst.getMat();
|
||||
cvInpaint( &c_src, &c_mask, &c_dst, inpaintRange, flags );
|
||||
}
|
||||
|
||||
@@ -607,7 +607,8 @@ Moments::operator CvMoments() const
|
||||
cv::Moments cv::moments( const InputArray& _array, bool binaryImage )
|
||||
{
|
||||
CvMoments om;
|
||||
CvMat c_array = _array.getMat();
|
||||
Mat arr = _array.getMat();
|
||||
CvMat c_array = arr;
|
||||
cvMoments(&c_array, &om, binaryImage);
|
||||
return om;
|
||||
}
|
||||
|
||||
@@ -303,9 +303,10 @@ cvWatershed( const CvArr* srcarr, CvArr* dstarr )
|
||||
}
|
||||
|
||||
|
||||
void cv::watershed( const InputArray& src, InputOutputArray markers )
|
||||
void cv::watershed( const InputArray& _src, InputOutputArray markers )
|
||||
{
|
||||
CvMat c_src = src.getMat(), c_markers = markers.getMat();
|
||||
Mat src = _src.getMat();
|
||||
CvMat c_src = _src.getMat(), c_markers = markers.getMat();
|
||||
cvWatershed( &c_src, &c_markers );
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user