Opened 15 years ago
Last modified 14 years ago
#24594 closed defect
OpenCV 2.0 - HoughLinesP memory allocation — at Initial Version
Reported by: | nicola.conci@… | Owned by: | macports-tickets@… |
---|---|---|---|
Priority: | Normal | Milestone: | |
Component: | ports | Version: | 1.8.2 |
Keywords: | Cc: | ||
Port: | OpenCV |
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