Permalink
Browse files

Fixed memory leaks.

  • Loading branch information...
1 parent 9cbf187 commit 44830b445f52e7db265a5087652962fe99007185 @jeradesign committed Jul 30, 2012
Showing with 29 additions and 80 deletions.
  1. +2 −5 CVFunhouse/CVFFarneback.m
  2. +2 −0 CVFunhouse/CVFMotionTemplates.m
  3. +25 −75 TODO.rtf
@@ -50,12 +50,8 @@ @implementation CVFFarneback
* imageReady: will dispose of the IplImage you pass it once the system is
* done with it.
*/
--(void)processIplImage:(IplImage*)iplImage
+-(void)processIplImage:(IplImage*)frame
{
- IplImage *frame = cvCreateImage(cvGetSize(iplImage), IPL_DEPTH_8U, 3);
- cvCvtColor(iplImage, frame, CV_BGR2RGB);
- cvReleaseImage(&iplImage);
-
int firstFrame = (gray == 0);
if(!gray)
{
@@ -65,6 +61,7 @@ -(void)processIplImage:(IplImage*)iplImage
cflow = cvCreateMat(gray->rows, gray->cols, CV_8UC3);
}
cvCvtColor(frame, gray, CV_BGR2GRAY);
+ cvReleaseImage(&frame);
if( !firstFrame )
{
@@ -189,6 +189,8 @@ -(void)processIplImage:(IplImage*)image
update_mhi( image, motion, 30 );
+ cvReleaseImage(&image);
+
// Call imageReady with your new image.
IplImage *outImage = cvCloneImage(motion);
[self imageReady:outImage];
View
100 TODO.rtf
@@ -2,19 +2,37 @@
{\fonttbl\f0\fswiss\fcharset0 Helvetica;\f1\fswiss\fcharset0 ArialMT;\f2\fnil\fcharset0 LucidaGrande;
}
{\colortbl;\red255\green255\blue255;\red26\green26\blue26;}
-{\*\listtable{\list\listtemplateid1\listhybrid{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace360\levelindent0{\*\levelmarker \{disc\}}{\leveltext\leveltemplateid1\'01\uc0\u8226 ;}{\levelnumbers;}\fi-360\li720\lin720 }{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace360\levelindent0{\*\levelmarker \{hyphen\}}{\leveltext\leveltemplateid2\'01\uc0\u8259 ;}{\levelnumbers;}\fi-360\li1440\lin1440 }{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace360\levelindent0{\*\levelmarker \{hyphen\}}{\leveltext\leveltemplateid3\'01\uc0\u8259 ;}{\levelnumbers;}\fi-360\li2160\lin2160 }{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace360\levelindent0{\*\levelmarker \{hyphen\}}{\leveltext\leveltemplateid4\'01\uc0\u8259 ;}{\levelnumbers;}\fi-360\li2880\lin2880 }{\listname ;}\listid1}}
-{\*\listoverridetable{\listoverride\listid1\listoverridecount0\ls1}}
+{\*\listtable{\list\listtemplateid1\listhybrid{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace360\levelindent0{\*\levelmarker \{disc\}}{\leveltext\leveltemplateid1\'01\uc0\u8226 ;}{\levelnumbers;}\fi-360\li720\lin720 }{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace360\levelindent0{\*\levelmarker \{hyphen\}}{\leveltext\leveltemplateid2\'01\uc0\u8259 ;}{\levelnumbers;}\fi-360\li1440\lin1440 }{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace360\levelindent0{\*\levelmarker \{hyphen\}}{\leveltext\leveltemplateid3\'01\uc0\u8259 ;}{\levelnumbers;}\fi-360\li2160\lin2160 }{\listname ;}\listid1}
+{\list\listtemplateid2\listhybrid{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace360\levelindent0{\*\levelmarker \{disc\}}{\leveltext\leveltemplateid101\'01\uc0\u8226 ;}{\levelnumbers;}\fi-360\li720\lin720 }{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace360\levelindent0{\*\levelmarker \{hyphen\}}{\leveltext\leveltemplateid102\'01\uc0\u8259 ;}{\levelnumbers;}\fi-360\li1440\lin1440 }{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace360\levelindent0{\*\levelmarker \{hyphen\}}{\leveltext\leveltemplateid103\'01\uc0\u8259 ;}{\levelnumbers;}\fi-360\li2160\lin2160 }{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace360\levelindent0{\*\levelmarker \{hyphen\}}{\leveltext\leveltemplateid104\'01\uc0\u8259 ;}{\levelnumbers;}\fi-360\li2880\lin2880 }{\listname ;}\listid2}}
+{\*\listoverridetable{\listoverride\listid1\listoverridecount0\ls1}{\listoverride\listid2\listoverridecount0\ls2}}
\margl1440\margr1440\vieww9000\viewh8400\viewkind0
\pard\tx220\tx720\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\li720\fi-720\pardirnatural
\ls1\ilvl0
\f0\fs24 \cf0 {\listtext \'95 }TODO\
\pard\tx940\tx1440\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\li1440\fi-1440\pardirnatural
-\ls1\ilvl1\cf0 {\listtext \uc0\u8259 }Integrate video demos from samples bundled with OpenCV.\
+\ls1\ilvl1\cf0 {\listtext \uc0\u8259 }Build opencv2.framework with optimizations turned on.\
+{\listtext \uc0\u8259 }Disable "switch camera" button for devices with only one camera.\
+{\listtext \uc0\u8259 }Set default demo to passthru if no demo found in switch statement.\
+{\listtext \uc0\u8259 }Figure out how to add demos without touching CVFMainViewController and CVFFlipsideViewController every time.\
+{\listtext \uc0\u8259 }"App mode"\
+\pard\tx1660\tx2160\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\li2160\fi-2160\pardirnatural
+\ls1\ilvl2\cf0 {\listtext \uc0\u8259 }Used for writing custom apps based on CVFunhouse\
+{\listtext \uc0\u8259 }Separate target\
+{\listtext \uc0\u8259 }No demos\
+{\listtext \uc0\u8259 }Use metadata to load single class in CVMainViewController\
+{\listtext \uc0\u8259 }Custom flipside view and view controller\
+\pard\tx940\tx1440\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\li1440\fi-1440\pardirnatural
+\ls1\ilvl1\cf0 {\listtext \uc0\u8259 }Add FPS display\
+{\listtext \uc0\u8259 }Is it threadsafe to let a demo recycle its output image?\
+\pard\tx220\tx720\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\li720\fi-720\pardirnatural
+\ls1\ilvl0\cf0 {\listtext \'95 }DONE\
+\pard\tx940\tx1440\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\li1440\fi-1440\pardirnatural
+\ls2\ilvl1\cf0 {\listtext \uc0\u8259 }Integrate video demos from samples bundled with OpenCV.\
\pard\tx1660\tx2160\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\li2160\fi-2160\pardirnatural
-\ls1\ilvl2\cf0 {\listtext \uc0\u8259 }
+\ls2\ilvl2\cf0 {\listtext \uc0\u8259 }
\f1\fs26 \cf2 c:\
\pard\tx2380\tx2880\pardeftab720\li2880\fi-2880
-\ls1\ilvl3\cf2 {\listtext
+\ls2\ilvl3\cf2 {\listtext
\f2 \uc0\u8259
\f1 }facedetect.cpp\
{\listtext
@@ -23,83 +41,15 @@
{\listtext
\f2 \uc0\u8259
\f1 }motempl.c\
-{\listtext
-\f2 \uc0\u8259
-\f1 }polar_transforms.c\
\pard\tx1660\tx2160\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\li2160\fi-2160\pardirnatural
-\ls1\ilvl2
+\ls2\ilvl2
\f0\fs24 \cf0 {\listtext \uc0\u8259 }
\f1\fs26 \cf2 cpp:\
\pard\tx2380\tx2880\pardeftab720\li2880\fi-2880
-\ls1\ilvl3\cf2 {\listtext
-\f2 \uc0\u8259
-\f1 }bgfg_segm.cpp\
-{\listtext
-\f2 \uc0\u8259
-\f1 }calibration.cpp\
-{\listtext
-\f2 \uc0\u8259
-\f1 }camshiftdemo.cpp\
-{\listtext
-\f2 \uc0\u8259
-\f1 }fback.cpp\
-{\listtext
-\f2 \uc0\u8259
-\f1 }hybridtrackingsample.cpp\
-{\listtext
+\ls2\ilvl3\cf2 {\listtext
\f2 \uc0\u8259
\f1 }laplace.cpp\
{\listtext
\f2 \uc0\u8259
-\f1 }linemod.cpp\
-{\listtext
-\f2 \uc0\u8259
\f1 }lkdemo.cpp\
-{\listtext
-\f2 \uc0\u8259
-\f1 }multicascadeclassifier.cpp\
-{\listtext
-\f2 \uc0\u8259
-\f1 }openni_capture.cpp\
-{\listtext
-\f2 \uc0\u8259
-\f1 }phase_corr.cpp\
-{\listtext
-\f2 \uc0\u8259
-\f1 }retinaDemo.cpp\
-{\listtext
-\f2 \uc0\u8259
-\f1 }segment_objects.cpp\
-{\listtext
-\f2 \uc0\u8259
-\f1 }select3dobj.cpp\
-{\listtext
-\f2 \uc0\u8259
-\f1 }starter_video.cpp\
-{\listtext
-\f2 \uc0\u8259
-\f1 }video_dmtx.cpp\
-{\listtext
-\f2 \uc0\u8259
-\f1 }video_homography.cpp\
-\pard\tx2380\tx2880\pardeftab720\li2880\fi-2880
-\ls1\ilvl3
-\f0\fs24 \cf0 {\listtext \uc0\u8259 }Build opencv2.framework with optimizations turned on.\
-\pard\tx940\tx1440\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\li1440\fi-1440\pardirnatural
-\ls1\ilvl1\cf0 {\listtext \uc0\u8259 }Build opencv2.framework with optimizations turned on.\
-{\listtext \uc0\u8259 }Disable "switch camera" button for devices with only one camera.\
-{\listtext \uc0\u8259 }Set default demo to passthru if no demo found in switch statement.\
-{\listtext \uc0\u8259 }Figure out how to add demos without touching CVFMainViewController and CVFFlipsideViewController every time.\
-{\listtext \uc0\u8259 }"App mode"\
-\pard\tx1660\tx2160\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\li2160\fi-2160\pardirnatural
-\ls1\ilvl2\cf0 {\listtext \uc0\u8259 }Used for writing custom apps based on CVFunhouse\
-{\listtext \uc0\u8259 }Separate target\
-{\listtext \uc0\u8259 }No demos\
-{\listtext \uc0\u8259 }Use metadata to load single class in CVMainViewController\
-{\listtext \uc0\u8259 }Custom flipside view and view controller\
-\pard\tx940\tx1440\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\li1440\fi-1440\pardirnatural
-\ls1\ilvl1\cf0 {\listtext \uc0\u8259 }Add FPS display\
-{\listtext \uc0\u8259 }Is it threadsafe to let a demo recycle its output image?\
-\pard\tx220\tx720\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\li720\fi-720\pardirnatural
-\ls1\ilvl0\cf0 {\listtext \'95 }DONE\
}

0 comments on commit 44830b4

Please sign in to comment.