1 /*M///////////////////////////////////////////////////////////////////////////////////////
3 // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
5 // By downloading, copying, installing or using the software you agree to this license.
6 // If you do not agree to this license, do not download, install,
7 // copy or use the software.
10 // Intel License Agreement
11 // For Open Source Computer Vision Library
13 // Copyright (C) 2000, Intel Corporation, all rights reserved.
14 // Third party copyrights are property of their respective owners.
16 // Redistribution and use in source and binary forms, with or without modification,
17 // are permitted provided that the following conditions are met:
19 // * Redistribution's of source code must retain the above copyright notice,
20 // this list of conditions and the following disclaimer.
22 // * Redistribution's in binary form must reproduce the above copyright notice,
23 // this list of conditions and the following disclaimer in the documentation
24 // and/or other materials provided with the distribution.
26 // * The name of Intel Corporation may not be used to endorse or promote products
27 // derived from this software without specific prior written permission.
29 // This software is provided by the copyright holders and contributors "as is" and
30 // any express or implied warranties, including, but not limited to, the implied
31 // warranties of merchantability and fitness for a particular purpose are disclaimed.
32 // In no event shall the Intel Corporation or contributors be liable for any direct,
33 // indirect, incidental, special, exemplary, or consequential damages
34 // (including, but not limited to, procurement of substitute goods or services;
35 // loss of use, data, or profits; or business interruption) however caused
36 // and on any theory of liability, whether in contract, strict liability,
37 // or tort (including negligence or otherwise) arising in any way out of
38 // the use of this software, even if advised of the possibility of such damage.
40 //M*/// FaceBase.h: interface for the CFaceBase class.
42 //////////////////////////////////////////////////////////////////////
44 #if !defined(AFX_FACEBASE_H__76CC3F61_D0C7_4CF8_8479_84950282D632__INCLUDED_)
45 #define AFX_FACEBASE_H__76CC3F61_D0C7_4CF8_8479_84950282D632__INCLUDED_
49 #endif // _MSC_VER > 1000
53 #define TRAIN_UNTRAINED 2
59 typedef CList<CPersonImage*,CPersonImage*> CPersonImgList;
60 typedef CList<CPerson*,CPerson*> CPersonList;
65 int RecognizeOtherBase(CFaceBase* other );
66 int RecognizePerson(CImage& image, CRect roi, int* three_first );
67 int RecognizeBatch(CStringList* image_list);
69 void TrainAll( int flag );
70 void TrainPerson( int index, bool loaded );
74 void SetFileName( const CString& filename );
75 const CString& GetFileName() { return m_filename; }
76 void SetName( const CString& name );
77 const CString& GetName() { return m_basename; }
81 CPerson* AddPerson( const char* name, const char* folder, bool import_data );
82 void RemovePerson( POSITION pos );
83 CPersonList& GetPersonList() { return m_base; };
84 void SetImageSize( CSize size );
85 CSize GetImageSize() { return m_baseImgSize; };
86 void SetModified( bool modified = true ) { m_modified = modified; }
87 bool IsModified() { return m_modified; }
88 void Draw( int index, CImage& img, SIZE win_size, int y_pos,
89 SIZE pic_size, SIZE delta );
90 CPerson* GetPerson( int index );
91 CPerson* FindPersonByName( const CString& name );
92 int GetPersonIndex( CPerson* person );
93 CImage& GetTrainedImage() { return m_trained_image; }
94 int GetTrainedIndex() { return m_trained_index; }
95 void SetTrainedIndex( int index ) { m_trained_index = index; }
96 void UpdateTrainedImage();
97 void SetBaseView( CWnd* view ) { m_base_view = view; }
98 CWnd* GetBaseView() { return m_base_view; }
101 int SetParams( //sampling params
106 int* states, int mix,
107 //image scaling params
108 BOOL use_width, int width,
109 BOOL use_height, int height,
110 BOOL suppress_intens,
111 BOOL leave_hmm_alive = FALSE);
127 BOOL m_suppress_intensity;
136 CImage m_trained_image;
139 bool GetPersonFolder( const char* root_folder, int root_folder_len,
140 const char* person_folder, char* folder );
141 void GetPersonSubFolder( const char* folder, char* subfolder );
142 void GetRootFolder( char* root_folder, int* root_path_len );
151 CPerson( CFaceBase* parent );
154 void SetName( const CString& name );
155 const CString& GetName() { return m_name; }
156 void SetFolder( const CString& folder );
157 void GenerateFileName( const char* base, char* filename );
158 const CString& GetFolder() { return m_folder; }
159 void AddImage( const char* filename, CImage* import_image, CRect roi );
160 void RemoveImage( POSITION pos );
161 void MoveToTop( POSITION pos );
167 CPersonImgList& GetImgList() { return m_imgs; }
168 void SetModified( bool modified = true )
170 m_modified = modified;
174 bool IsModified() { return m_modified; }
175 CFaceBase* GetParentBase() { return m_parent; }
177 bool IsTrained() { return m_trained; };
178 void DeleteHMMInfo();
184 CPersonImgList m_imgs;
193 bool GetPersonFullImageName( const char* root, int root_len,
194 const char* image, char* full_image_name );
195 void ExtractPersonImageName( const char* full_image_name, char* image );
204 virtual ~CPersonImage();
208 void SetFileName( const CString& filename );
209 void SetRoiInFile( CRect r );
210 CRect GetRoiInFile() { return m_roi_in_file; }
211 const CString& GetFileName() { return m_filename; }
212 void SetModified( bool modified = true ) { m_modified = modified; }
213 bool IsModified() { return m_modified; }
214 void CalcRect( SIZE win_size, POINT pos, SIZE base_size,
215 CRect& src_rect, CRect& dst_rect );
216 void Draw( CImage& img, SIZE win_size, POINT pos, SIZE pic_size );
217 CImage& GetImage() { return m_img; }
226 void ConvertNameToFolder( const char* name, char* folder );
228 #endif // !defined(AFX_FACEBASE_H__76CC3F61_D0C7_4CF8_8479_84950282D632__INCLUDED_)