[MacPorts] #24594: OpenCV 2.0 - HoughLinesP memory allocation
MacPorts
noreply at macports.org
Thu Apr 22 07:49:54 PDT 2010
#24594: OpenCV 2.0 - HoughLinesP memory allocation
------------------------------------+---------------------------------------
Reporter: nicola.conci@… | Owner: stante@…
Type: defect | Status: new
Priority: Normal | Milestone:
Component: ports | Version: 1.8.2
Keywords: | Port: OpenCV
------------------------------------+---------------------------------------
Changes (by jmr@…):
* owner: macports-tickets@… => stante@…
* port: => OpenCV
Old description:
> hi,
> I tried running the HoughLinesP function on a video, to check consistency
> of lines over successive frames. I guess there is something wrong with
> the allocation/deallocation though, since running it several times you
> notice the memory increases until the computer slows down.
>
> if I comment the HoughLinesP function, everything runs smoothly.
>
> That's a sample of the code (myFrame and edges are 320x240):
>
> int blockSize=8;
>
> for (int c=1;c<300;c++) {
>
> cap >> myFrame;
>
> cvtColor(myFrame, edges, CV_RGB2GRAY, 0);
>
> Canny(edges, edges, 80, 120, 3, false);
>
> for (int k=0;k<(edges.rows-blockSize);k+=blockSize-1) {
> for (int l=0;l<(edges.cols-
> blockSize);l+=blockSize-1) {
> vector<Vec4i> lines;
> Mat
> blockEdge(edges,Rect(l,k,blockSize,blockSize));
> Mat
> blockOrig(myFrame,Rect(l,k,blockSize,blockSize));
> //APPLY HOUGH
> HoughLinesP(blockEdge, lines, 1,
> CV_PI/90, 5, 4, 10 );
>
> blockEdge.release();
> blockOrig.release();
>
> }
> }
>
> waitKey(10);
> printf("Frame n: %d", c);
>
> }
>
>
> Thanks,
> Nicola
New description:
hi,
I tried running the HoughLinesP function on a video, to check consistency
of lines over successive frames. I guess there is something wrong with the
allocation/deallocation though, since running it several times you notice
the memory increases until the computer slows down.
if I comment the HoughLinesP function, everything runs smoothly.
That's a sample of the code (myFrame and edges are 320x240):
{{{
int blockSize=8;
for (int c=1;c<300;c++) {
cap >> myFrame;
cvtColor(myFrame, edges, CV_RGB2GRAY, 0);
Canny(edges, edges, 80, 120, 3, false);
for (int k=0;k<(edges.rows-blockSize);k+=blockSize-1) {
for (int l=0;l<(edges.cols-
blockSize);l+=blockSize-1) {
vector<Vec4i> lines;
Mat
blockEdge(edges,Rect(l,k,blockSize,blockSize));
Mat
blockOrig(myFrame,Rect(l,k,blockSize,blockSize));
//APPLY HOUGH
HoughLinesP(blockEdge, lines, 1, CV_PI/90,
5, 4, 10 );
blockEdge.release();
blockOrig.release();
}
}
waitKey(10);
printf("Frame n: %d", c);
}
}}}
Thanks,
Nicola
--
Comment:
Please remember to fill in the Port field and cc the maintainer.
--
Ticket URL: <http://trac.macports.org/ticket/24594#comment:1>
MacPorts <http://www.macports.org/>
Ports system for Mac OS
More information about the macports-tickets
mailing list