Merge pull request #74 from JanOosting/master

Squares demo: contour storage trashes Squares storage
This commit is contained in:
Laentir Valetov 2017-06-22 11:35:04 +04:00 committed by GitHub
commit 87d112e499

View File

@ -68,6 +68,8 @@ var
result_: PCvSeq;
rr: integer;
contourstorage: PCvMemStorage;
yy: pointer;
a: AnsiString;
begin
@ -92,6 +94,8 @@ begin
// cvSetImageROI(timg, cvRect(0, 0, sz.width, sz.height));
cvResetImageROI(timg);
contourstorage := cvCreateMemStorage(0);
// down-scale and upscale the image to filter out the noise
cvPyrDown(timg, pyr, 7);
cvPyrUp(pyr, timg, 7);
@ -131,8 +135,8 @@ begin
// try
// find contours and store them all as a list
cvClearMemStorage(storage);
rr := cvFindContours(gray, storage, @contours, sizeof(TCvContour), CV_RETR_LIST, CV_CHAIN_APPROX_SIMPLE,
cvClearMemStorage(contourstorage);
rr := cvFindContours(gray, contourstorage, @contours, sizeof(TCvContour), CV_RETR_LIST, CV_CHAIN_APPROX_SIMPLE,
CvPoint(0, 0));
// test each contour
@ -186,7 +190,7 @@ begin
cvReleaseImage(pyr);
cvReleaseImage(tgray);
cvReleaseImage(timg);
cvReleaseMemStorage(contourstorage);
result := Squares;
end;