00001 /*M/////////////////////////////////////////////////////////////////////////////////////// 00002 // 00003 // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. 00004 // 00005 // By downloading, copying, installing or using the software you agree to this license. 00006 // If you do not agree to this license, do not download, install, 00007 // copy or use the software. 00008 // 00009 // 00010 // Intel License Agreement 00011 // For Open Source Computer Vision Library 00012 // 00013 // Contributors License Agreement 00014 // 00015 // Copyright (C) 2006, Zecchini Fabio, all rights reserved. 00016 // 00017 // Copyright (C) 2006, Cora' Massimo, all rights reserved. Code adapting and integration into Omnimeeting. 00018 // 00019 // Third party copyrights are property of their respective owners. 00020 // 00021 // Redistribution and use in source and binary forms, with or without modification, 00022 // are permitted provided that the following conditions are met: 00023 // 00024 // * Redistribution's of source code must retain the above copyright notice, 00025 // this list of conditions and the following disclaimer. 00026 // 00027 // * Redistribution's in binary form must reproduce the above copyright notice, 00028 // this list of conditions and the following disclaimer in the documentation 00029 // and/or other materials provided with the distribution. 00030 // 00031 // * The name of Intel Corporation may not be used to endorse or promote products 00032 // derived from this software without specific prior written permission. 00033 // 00034 // This software is provided by the copyright holders and contributors "as is" and 00035 // any express or implied warranties, including, but not limited to, the implied 00036 // warranties of merchantability and fitness for a particular purpose are disclaimed. 00037 // In no event shall the Intel Corporation or contributors be liable for any direct, 00038 // indirect, incidental, special, exemplary, or consequential damages 00039 // (including, but not limited to, procurement of substitute goods or services; 00040 // loss of use, data, or profits; or business interruption) however caused 00041 // and on any theory of liability, whether in contract, strict liability, 00042 // or tort (including negligence or otherwise) arising in any way out of 00043 // the use of this software, even if advised of the possibility of such damage. 00044 // 00045 //M*/ 00046 00047 #ifndef _CVVRFILTER_H_ 00048 #define _CVVRFILTER_H_ 00049 00050 #include <cv.h> 00051 #include <cvaux.h> 00052 #include <highgui.h> 00053 #include <stdio.h> 00054 00055 00056 // uncomment to see opencv windows displayed. 00057 //#define SKIN_SHOW 00058 00059 // referring to box.size.height/box.size.width 00060 #define H_ON_W_VALUE 1.5 00061 00062 // referring to box.size.width/box.size.height 00063 #define W_ON_H_VALUE 1.5 00064 00065 00078 struct Cvface { 00079 00080 struct Cvskin { 00082 CvRect skin_rect; 00084 CvBox2D skin_box; 00085 00087 CvSeq skin_contour; 00088 00089 }skin_face; 00090 00092 CvBox2D mouth_box; 00093 00095 CvBox2D eyes_box [2]; 00096 00098 bool track ; 00099 00100 }; 00101 00110 class CvVrFilter 00111 { 00113 IplImage *median ; 00115 IplImage *rgb_norm ; 00117 IplImage*skin_mask ; 00119 IplImage *source; 00121 CvSize size; 00123 CvSeq *skin; 00125 int min_point ; 00127 int max_point ; 00128 00130 bool started ; 00131 00132 public: 00133 00135 00141 CvVrFilter (int min = 0, int max = 10000); 00142 00144 virtual ~CvVrFilter(); 00145 00147 00154 IplImage * cvVrFilter( IplImage * image, CvMemStorage *storage, CvSeq *seq); 00155 00157 00161 IplImage * cvGetSkinMask(); 00162 00164 00169 IplImage * cvGetSkinMap(CvSeq *seq); 00170 00172 00179 IplImage * cvGetContoursMask(CvSeq *seq , bool color_mask = false); 00180 00182 00188 IplImage * cvGetContoursMap(CvSeq *seq); 00189 00191 00194 int cvGetContoursCount(); 00195 00196 00197 private: //function 00198 00200 00204 IplImage * icvRGBnorm(IplImage * image); 00205 00207 00214 double *icvPline (double x1, double x2, double y1, double y2); 00215 00217 00220 void icvSkinMask (); 00221 00222 00224 00228 void icvContours(CvMemStorage *storage, CvSeq *seq); 00229 00230 00231 //return 00232 //src and mask must have the same size (width, height) 00233 00235 00240 IplImage * icvCreateMap(const IplImage * src, const IplImage * mask); 00241 00242 00243 }; 00244 00245 #endif /*_CVVRFILTER_H_*/