aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlluís gómez i bigordà <lluisbigorda@users.sourceforge.net>2009-01-25 00:37:29 +0000
committerlluís gómez i bigordà <lluisbigorda@users.sourceforge.net>2009-01-25 00:37:29 +0000
commitb340f1f621f861a89267c4e8b456f7d47713faf6 (patch)
tree72b450aaa464098ac2fcaa1b72f919411924fde7
parentf8acef999269952a3d8e20737662d20adecc32e7 (diff)
deleted wrong help file
svn path=/trunk/externals/pdp_opencv/; revision=10622
-rw-r--r--COPYING36
-rw-r--r--README1
-rw-r--r--pdp_opencv_bgsubstract.c52
-rw-r--r--pdp_opencv_contours_composition-help.pd49
-rw-r--r--pdp_opencv_haarcascade.c3
5 files changed, 79 insertions, 62 deletions
diff --git a/COPYING b/COPYING
new file mode 100644
index 0000000..98efdb1
--- /dev/null
+++ b/COPYING
@@ -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.
diff --git a/README b/README
deleted file mode 100644
index a138819..0000000
--- a/README
+++ /dev/null
@@ -1 +0,0 @@
-See docs/index.htm
diff --git a/pdp_opencv_bgsubstract.c b/pdp_opencv_bgsubstract.c
index 406311b..1895a82 100644
--- a/pdp_opencv_bgsubstract.c
+++ b/pdp_opencv_bgsubstract.c
@@ -52,7 +52,7 @@ typedef struct pdp_opencv_bgsubstract_struct
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 @@ static void pdp_opencv_bgsubstract_process_rgb(t_pdp_opencv_bgsubstract *x)
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 @@ static void pdp_opencv_bgsubstract_process_rgb(t_pdp_opencv_bgsubstract *x)
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,20 +101,48 @@ static void pdp_opencv_bgsubstract_process_rgb(t_pdp_opencv_bgsubstract *x)
// 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);
+
+ 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;
+ }
+ }
- cvCvtColor(x->diff_8U,x->image,CV_GRAY2BGR);
memcpy( newdata, x->image->imageData, x->x_size*3 );
@@ -201,7 +229,7 @@ static void pdp_opencv_bgsubstract_free(t_pdp_opencv_bgsubstract *x)
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 @@ void *pdp_opencv_bgsubstract_new(t_floatarg f)
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;
diff --git a/pdp_opencv_contours_composition-help.pd b/pdp_opencv_contours_composition-help.pd
deleted file mode 100644
index f8b33c3..0000000
--- a/pdp_opencv_contours_composition-help.pd
+++ /dev/null
@@ -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;
diff --git a/pdp_opencv_haarcascade.c b/pdp_opencv_haarcascade.c
index c91e52e..cee9547 100644
--- a/pdp_opencv_haarcascade.c
+++ b/pdp_opencv_haarcascade.c
@@ -47,6 +47,7 @@ typedef struct pdp_opencv_haarcascade_struct
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 @@ static void pdp_opencv_haarcascade_process_rgb(t_pdp_opencv_haarcascade *x)
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 @@ void *pdp_opencv_haarcascade_new(t_floatarg f)
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;