|
Video Processing Framework
|
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 // Copyright (C) 2000, Intel Corporation, all rights reserved. 00014 // Third party copyrights are property of their respective owners. 00015 // 00016 // Redistribution and use in source and binary forms, with or without modification, 00017 // are permitted provided that the following conditions are met: 00018 // 00019 // * Redistribution's of source code must retain the above copyright notice, 00020 // this list of conditions and the following disclaimer. 00021 // 00022 // * Redistribution's in binary form must reproduce the above copyright notice, 00023 // this list of conditions and the following disclaimer in the documentation 00024 // and/or other materials provided with the distribution. 00025 // 00026 // * The name of Intel Corporation may not be used to endorse or promote products 00027 // derived from this software without specific prior written permission. 00028 // 00029 // This software is provided by the copyright holders and contributors "as is" and 00030 // any express or implied warranties, including, but not limited to, the implied 00031 // warranties of merchantability and fitness for a particular purpose are disclaimed. 00032 // In no event shall the Intel Corporation or contributors be liable for any direct, 00033 // indirect, incidental, special, exemplary, or consequential damages 00034 // (including, but not limited to, procurement of substitute goods or services; 00035 // loss of use, data, or profits; or business interruption) however caused 00036 // and on any theory of liability, whether in contract, strict liability, 00037 // or tort (including negligence or otherwise) arising in any way out of 00038 // the use of this software, even if advised of the possibility of such damage. 00039 // 00040 //M*/ 00041 00042 #ifndef __CVAUX_HPP__ 00043 #define __CVAUX_HPP__ 00044 00045 #ifdef __cplusplus 00046 00047 /****************************************************************************************\ 00048 * Image class * 00049 \****************************************************************************************/ 00050 00051 class CV_EXPORTS CvCamShiftTracker 00052 { 00053 public: 00054 00055 CvCamShiftTracker(); 00056 virtual ~CvCamShiftTracker(); 00057 00058 /**** Characteristics of the object that are calculated by track_object method *****/ 00059 float get_orientation() const // orientation of the object in degrees 00060 { return m_box.angle; } 00061 float get_length() const // the larger linear size of the object 00062 { return m_box.size.height; } 00063 float get_width() const // the smaller linear size of the object 00064 { return m_box.size.width; } 00065 CvPoint2D32f get_center() const // center of the object 00066 { return m_box.center; } 00067 CvRect get_window() const // bounding rectangle for the object 00068 { return m_comp.rect; } 00069 00070 /*********************** Tracking parameters ************************/ 00071 int get_threshold() const // thresholding value that applied to back project 00072 { return m_threshold; } 00073 00074 int get_hist_dims( int* dims = 0 ) const // returns number of histogram dimensions and sets 00075 { return m_hist ? cvGetDims( m_hist->bins, dims ) : 0; } 00076 00077 int get_min_ch_val( int channel ) const // get the minimum allowed value of the specified channel 00078 { return m_min_ch_val[channel]; } 00079 00080 int get_max_ch_val( int channel ) const // get the maximum allowed value of the specified channel 00081 { return m_max_ch_val[channel]; } 00082 00083 // set initial object rectangle (must be called before initial calculation of the histogram) 00084 bool set_window( CvRect window) 00085 { m_comp.rect = window; return true; } 00086 00087 bool set_threshold( int threshold ) // threshold applied to the histogram bins 00088 { m_threshold = threshold; return true; } 00089 00090 bool set_hist_bin_range( int dim, int min_val, int max_val ); 00091 00092 bool set_hist_dims( int c_dims, int* dims );// set the histogram parameters 00093 00094 bool set_min_ch_val( int channel, int val ) // set the minimum allowed value of the specified channel 00095 { m_min_ch_val[channel] = val; return true; } 00096 bool set_max_ch_val( int channel, int val ) // set the maximum allowed value of the specified channel 00097 { m_max_ch_val[channel] = val; return true; } 00098 00099 /************************ The processing methods *********************************/ 00100 // update object position 00101 virtual bool track_object( const IplImage* cur_frame ); 00102 00103 // update object histogram 00104 virtual bool update_histogram( const IplImage* cur_frame ); 00105 00106 // reset histogram 00107 virtual void reset_histogram(); 00108 00109 /************************ Retrieving internal data *******************************/ 00110 // get back project image 00111 virtual IplImage* get_back_project() 00112 { return m_back_project; } 00113 00114 float query( int* bin ) const 00115 { return m_hist ? (float)cvGetRealND(m_hist->bins, bin) : 0.f; } 00116 00117 protected: 00118 00119 // internal method for color conversion: fills m_color_planes group 00120 virtual void color_transform( const IplImage* img ); 00121 00122 CvHistogram* m_hist; 00123 00124 CvBox2D m_box; 00125 CvConnectedComp m_comp; 00126 00127 float m_hist_ranges_data[CV_MAX_DIM][2]; 00128 float* m_hist_ranges[CV_MAX_DIM]; 00129 00130 int m_min_ch_val[CV_MAX_DIM]; 00131 int m_max_ch_val[CV_MAX_DIM]; 00132 int m_threshold; 00133 00134 IplImage* m_color_planes[CV_MAX_DIM]; 00135 IplImage* m_back_project; 00136 IplImage* m_temp; 00137 IplImage* m_mask; 00138 }; 00139 00140 #endif /* __cplusplus */ 00141 00142 #endif /* __CVAUX_HPP__ */ 00143 00144 /* End of file. */