[vlc-commits] commit: OpenCV: cosmetics. ( Rémi Duraffort )

git at videolan.org git at videolan.org
Sun Mar 7 20:40:45 CET 2010


vlc | branch: master | Rémi Duraffort <ivoire at videolan.org> | Sun Mar  7 20:40:20 2010 +0100| [6ad0cd7e82e6cd78206b2c3d5ed7278fb0766caf] | committer: Rémi Duraffort 

OpenCV: cosmetics.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=6ad0cd7e82e6cd78206b2c3d5ed7278fb0766caf
---

 modules/video_filter/opencv_example.cpp |   15 +++++----------
 1 files changed, 5 insertions(+), 10 deletions(-)

diff --git a/modules/video_filter/opencv_example.cpp b/modules/video_filter/opencv_example.cpp
index 159697f..59e1862 100644
--- a/modules/video_filter/opencv_example.cpp
+++ b/modules/video_filter/opencv_example.cpp
@@ -184,33 +184,28 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
 
     //perform face detection
     cvClearMemStorage(p_filter->p_sys->p_storage);
-    CvSeq* faces = NULL;
     if( p_filter->p_sys->p_cascade )
     {
         //we should make some of these params config variables
-        faces = cvHaarDetectObjects( p_img[0], p_filter->p_sys->p_cascade,
+        CvSeq *faces = cvHaarDetectObjects( p_img[0], p_filter->p_sys->p_cascade,
             p_filter->p_sys->p_storage, 1.15, 5, CV_HAAR_DO_CANNY_PRUNING,
                                             cvSize(20, 20) );
         //create the video_filter_region_info_t struct
-        CvRect* r;
         if (faces && (faces->total > 0))
         {
             //msg_Dbg( p_filter, "Found %d face(s)", faces->total );
             free( p_filter->p_sys->event_info.p_region );
-            p_filter->p_sys->event_info.p_region = NULL;
-            if( NULL == ( p_filter->p_sys->event_info.p_region =
-                  (video_filter_region_info_t *)malloc(faces->total*sizeof(video_filter_region_info_t))))
-            {
+            p_filter->p_sys->event_info.p_region = (video_filter_region_info_t*)
+                    calloc( faces->total, sizeof(video_filter_region_info_t));
+            if( !p_filter->p_sys->event_info.p_region )
                 return NULL;
-            }
-            memset(p_filter->p_sys->event_info.p_region, 0, faces->total*sizeof(video_filter_region_info_t));
             p_filter->p_sys->event_info.i_region_size = faces->total;
         }
 
         //populate the video_filter_region_info_t struct
         for( i = 0; i < (faces ? faces->total : 0); i++ )
         {
-            r = (CvRect*)cvGetSeqElem( faces, i );
+            CvRect *r = (CvRect*)cvGetSeqElem( faces, i );
             pt1.x = r->x*scale;
             pt2.x = (r->x+r->width)*scale;
             pt1.y = r->y*scale;



More information about the vlc-commits mailing list