mirror of
https://github.com/Laex/Delphi-OpenCV.git
synced 2024-11-15 15:55:53 +01:00
Merge pull request #74 from JanOosting/master
Squares demo: contour storage trashes Squares storage
This commit is contained in:
commit
87d112e499
@ -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;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user