[PD-cvs] SF.net SVN: pure-data:[10622] trunk/externals/pdp_opencv

lluisbigorda at users.sourceforge.net lluisbigorda at users.sourceforge.net
Sun Jan 25 01:37:30 CET 2009


Revision: 10622
          http://pure-data.svn.sourceforge.net/pure-data/?rev=10622&view=rev
Author:   lluisbigorda
Date:     2009-01-25 00:37:29 +0000 (Sun, 25 Jan 2009)

Log Message:
-----------
 deleted wrong help file

Modified Paths:
--------------
    trunk/externals/pdp_opencv/pdp_opencv_bgsubstract.c
    trunk/externals/pdp_opencv/pdp_opencv_haarcascade.c

Added Paths:
-----------
    trunk/externals/pdp_opencv/COPYING

Removed Paths:
-------------
    trunk/externals/pdp_opencv/README
    trunk/externals/pdp_opencv/pdp_opencv_contours_composition-help.pd

Added: trunk/externals/pdp_opencv/COPYING
===================================================================
--- trunk/externals/pdp_opencv/COPYING	                        (rev 0)
+++ trunk/externals/pdp_opencv/COPYING	2009-01-25 00:37:29 UTC (rev 10622)
@@ -0,0 +1,36 @@
+IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. 
+
+By downloading, copying, installing or using the software you agree to this license.
+If you do not agree to this license, do not download, install,
+copy or use the software.
+
+
+                       Intel License Agreement 
+               For Open Source Computer Vision Library 
+
+Copyright (C) 2000, 2001, Intel Corporation, all rights reserved.
+Third party copyrights are property of their respective owners. 
+
+Redistribution and use in source and binary forms, with or without modification,
+are permitted provided that the following conditions are met:
+
+  * Redistribution's of source code must retain the above copyright notice,
+    this list of conditions and the following disclaimer.
+
+  * Redistribution's in binary form must reproduce the above copyright notice,
+    this list of conditions and the following disclaimer in the documentation
+    and/or other materials provided with the distribution.
+
+  * The name of Intel Corporation may not be used to endorse or promote products
+    derived from this software without specific prior written permission.
+
+This software is provided by the copyright holders and contributors "as is" and
+any express or implied warranties, including, but not limited to, the implied
+warranties of merchantability and fitness for a particular purpose are disclaimed.
+In no event shall the Intel Corporation or contributors be liable for any direct,
+indirect, incidental, special, exemplary, or consequential damages
+(including, but not limited to, procurement of substitute goods or services;
+loss of use, data, or profits; or business interruption) however caused
+and on any theory of liability, whether in contract, strict liability,
+or tort (including negligence or otherwise) arising in any way out of
+the use of this software, even if advised of the possibility of such damage.  

Deleted: trunk/externals/pdp_opencv/README
===================================================================
--- trunk/externals/pdp_opencv/README	2009-01-25 00:33:06 UTC (rev 10621)
+++ trunk/externals/pdp_opencv/README	2009-01-25 00:37:29 UTC (rev 10622)
@@ -1 +0,0 @@
-See docs/index.htm

Modified: trunk/externals/pdp_opencv/pdp_opencv_bgsubstract.c
===================================================================
--- trunk/externals/pdp_opencv/pdp_opencv_bgsubstract.c	2009-01-25 00:33:06 UTC (rev 10621)
+++ trunk/externals/pdp_opencv/pdp_opencv_bgsubstract.c	2009-01-25 00:37:29 UTC (rev 10622)
@@ -52,7 +52,7 @@
     int x_set; 
     int x_threshold; 
 
-    IplImage *image, *prev_gray, *gray, *grayLow, *grayUp, *diff_8U;
+    IplImage *image, *prev_image, *gray, *grayLow, *grayUp, *diff_8U;
     
 } t_pdp_opencv_bgsubstract;
 
@@ -79,7 +79,7 @@
     	cvReleaseImage(&x->gray);
     	cvReleaseImage(&x->grayLow);
     	cvReleaseImage(&x->grayUp);
-    	cvReleaseImage(&x->prev_gray);
+    	cvReleaseImage(&x->prev_image);
     	cvReleaseImage(&x->diff_8U);
     
 	//create the orig image with new size
@@ -88,7 +88,7 @@
     	x->gray = cvCreateImage(cvSize(x->image->width,x->image->height), IPL_DEPTH_8U, 1);
     	x->grayLow = cvCreateImage(cvSize(x->image->width,x->image->height), IPL_DEPTH_8U, 1);
     	x->grayUp = cvCreateImage(cvSize(x->image->width,x->image->height), IPL_DEPTH_8U, 1);
-        x->prev_gray = cvCreateImage( cvSize(x->image->width,x->image->height), 8, 1 );
+        x->prev_image = cvCreateImage( cvSize(x->image->width,x->image->height), 8, 3 );
         x->diff_8U = cvCreateImage( cvSize(x->image->width,x->image->height), 8, 1 );
     }
     
@@ -101,21 +101,49 @@
     // FEM UNA COPIA DEL PACKET A image->imageData ... http://www.cs.iit.edu/~agam/cs512/lect-notes/opencv-intro/opencv-intro.html aqui veiem la estructura de IplImage
     memcpy( x->image->imageData, data, x->x_size*3 );
 
-    cvCvtColor( x->image, x->gray, CV_BGR2GRAY );
+    //cvCvtColor( x->image, x->gray, CV_BGR2GRAY );
 
     if (x->x_set) {
-    	memcpy( x->prev_gray->imageData, x->gray->imageData, x->x_size );
+    	memcpy( x->prev_image->imageData, data, x->x_size*3 );
 	x->x_set=0;
     } 
 
-    cvSubS (x->prev_gray,cvScalar(x->x_threshold,x->x_threshold,x->x_threshold,x->x_threshold),x->grayLow,NULL);
-    cvAddS (x->prev_gray,cvScalar(x->x_threshold,x->x_threshold,x->x_threshold,x->x_threshold),x->grayUp,NULL);
-    cvInRange (x->gray, x->grayLow, x->grayUp, x->diff_8U);
+    //cvSubS (x->prev_image,cvScalar(x->x_threshold,x->x_threshold,x->x_threshold,x->x_threshold),x->grayLow,NULL);
+    //cvAddS (x->prev_image,cvScalar(x->x_threshold,x->x_threshold,x->x_threshold,x->x_threshold),x->grayUp,NULL);
+    //cvInRange (x->gray, x->grayLow, x->grayUp, x->diff_8U);
 
-    cvNot (x->diff_8U,x->diff_8U);
+    //cvNot (x->diff_8U,x->diff_8U);
 
-    cvCvtColor(x->diff_8U,x->image,CV_GRAY2BGR);
+    //cvCvtColor(x->diff_8U,x->image,CV_GRAY2BGR);
+
+  int h,w,hlength, chRed, chGreen, chBlue;
+  long src,pixsize;
+
+  chRed   =0;
+  chGreen =1;
+  chBlue  =2;
   
+  src = 0;
+
+
+  for (h=0; h<x->image->height; h++){
+    for(w=0; w<x->image->width; w++){
+      if (((x->image->imageData[src+chRed  ] > x->prev_image->imageData[src+chRed  ] - x->x_threshold)&&
+	   (x->image->imageData[src+chRed  ] < x->prev_image->imageData[src+chRed  ] + x->x_threshold))&&
+	  ((x->image->imageData[src+chGreen] > x->prev_image->imageData[src+chGreen] - x->x_threshold)&&
+	   (x->image->imageData[src+chGreen] < x->prev_image->imageData[src+chGreen] + x->x_threshold))&&
+	  ((x->image->imageData[src+chBlue ] > x->prev_image->imageData[src+chBlue ] - x->x_threshold)&&
+	   (x->image->imageData[src+chBlue ] < x->prev_image->imageData[src+chBlue ] + x->x_threshold)))
+	{
+	  x->image->imageData[src+chRed] = 0;
+	  x->image->imageData[src+chGreen] = 0;
+	  x->image->imageData[src+chBlue] = 0;
+	}
+      src+=3;
+    }
+  }
+
+  
     memcpy( newdata, x->image->imageData, x->x_size*3 );
  
     return;
@@ -201,7 +229,7 @@
     	cvReleaseImage(&x->gray);
     	cvReleaseImage(&x->grayLow);
     	cvReleaseImage(&x->grayUp);
-    	cvReleaseImage(&x->prev_gray);
+    	cvReleaseImage(&x->prev_image);
     	cvReleaseImage(&x->diff_8U);
 }
 
@@ -233,7 +261,7 @@
     x->gray = cvCreateImage(cvSize(x->image->width,x->image->height), IPL_DEPTH_8U, 1);
     x->grayLow = cvCreateImage(cvSize(x->image->width,x->image->height), IPL_DEPTH_8U, 1);
     x->grayUp = cvCreateImage(cvSize(x->image->width,x->image->height), IPL_DEPTH_8U, 1);
-    x->prev_gray = cvCreateImage( cvSize(x->image->width,x->image->height), 8, 1 );
+    x->prev_image = cvCreateImage( cvSize(x->image->width,x->image->height), 8, 3 );
     x->diff_8U = cvCreateImage( cvSize(x->image->width,x->image->height), 8, 1 );
 
     return (void *)x;

Deleted: trunk/externals/pdp_opencv/pdp_opencv_contours_composition-help.pd
===================================================================
--- trunk/externals/pdp_opencv/pdp_opencv_contours_composition-help.pd	2009-01-25 00:33:06 UTC (rev 10621)
+++ trunk/externals/pdp_opencv/pdp_opencv_contours_composition-help.pd	2009-01-25 00:37:29 UTC (rev 10622)
@@ -1,49 +0,0 @@
-#N canvas 0 51 521 599 10;
-#X obj 101 158 pdp_xv;
-#X msg 101 -138 open /dev/video0;
-#X obj 101 -90 pdp_v4l2;
-#X text 310 99 threshold value;
-#X obj 373 365 pdp_opencv_contours;
-#X obj 200 256 pdp_xv;
-#X obj 375 397 pdp_xv;
-#X obj 334 165 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 1
-1;
-#X msg 243 165 mode \$1;
-#X text 353 165 switch open/close and erode/dilate modes;
-#X floatatom 363 212 5 0 0 0 - - -;
-#X floatatom 520 365 5 0 0 0 - - -;
-#X floatatom 271 101 5 0 0 0 - - -;
-#X obj 458 335 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0
-1;
-#X obj 204 210 pdp_opencv_morphology;
-#X obj 337 325 pdp_xv;
-#X obj 471 234 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0
-1;
-#X msg 380 234 mode \$1;
-#X text 490 234 switch open/close and erode/dilate modes;
-#X floatatom 500 281 5 0 0 0 - - -;
-#X obj 341 279 pdp_opencv_morphology;
-#X obj 22 81 pdp_xv;
-#X text 231 22 threshold value;
-#X msg 128 -17 set;
-#X obj 22 22 pdp_opencv_bgsubstract;
-#X floatatom 192 24 5 0 0 0 - - -;
-#X obj 101 99 pdp_opencv_threshold;
-#X connect 1 0 2 0;
-#X connect 2 0 24 0;
-#X connect 4 0 6 0;
-#X connect 7 0 8 0;
-#X connect 8 0 14 0;
-#X connect 12 0 26 2;
-#X connect 13 0 4 1;
-#X connect 14 0 5 0;
-#X connect 14 0 20 0;
-#X connect 16 0 17 0;
-#X connect 17 0 20 0;
-#X connect 20 0 15 0;
-#X connect 23 0 24 0;
-#X connect 24 0 21 0;
-#X connect 24 0 26 0;
-#X connect 25 0 24 1;
-#X connect 26 0 0 0;
-#X connect 26 0 14 0;

Modified: trunk/externals/pdp_opencv/pdp_opencv_haarcascade.c
===================================================================
--- trunk/externals/pdp_opencv/pdp_opencv_haarcascade.c	2009-01-25 00:33:06 UTC (rev 10621)
+++ trunk/externals/pdp_opencv/pdp_opencv_haarcascade.c	2009-01-25 00:37:29 UTC (rev 10622)
@@ -47,6 +47,7 @@
     t_float x_f;
 
     t_outlet *x_outlet0;
+    t_outlet *x_outlet1;
     t_outlet *x_dataout;
     int x_packet0;
     int x_packet1;
@@ -149,6 +150,7 @@
 				x->scale_factor, x->min_neighbors, x->mode, cvSize(x->min_size, x->min_size) );
         //t = (double)cvGetTickCount() - t;
         //printf( "detection time = %gms\n", t/((double)cvGetTickFrequency()*1000.) );
+    outlet_float(x->x_outlet1, (float)faces->total);
         for( i = 0; i < (faces ? faces->total : 0); i++ )
         {
             CvRect* r = (CvRect*)cvGetSeqElem( faces, i );
@@ -293,6 +295,7 @@
     t_pdp_opencv_haarcascade *x = (t_pdp_opencv_haarcascade *)pd_new(pdp_opencv_haarcascade_class);
 
     x->x_outlet0 = outlet_new(&x->x_obj, &s_anything); 
+    x->x_outlet1 = outlet_new(&x->x_obj, &s_anything); 
     x->x_dataout = outlet_new(&x->x_obj, &s_anything); 
 
     x->x_packet0 = -1;


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Pd-cvs mailing list