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*/// MainFrm.h : interface of the CMainFrame class
42 /////////////////////////////////////////////////////////////////////////////
44 #if !defined(AFX_MAINFRM_H__A510D781_2548_11D3_8C73_00A0C998A94B__INCLUDED_)
45 #define AFX_MAINFRM_H__A510D781_2548_11D3_8C73_00A0C998A94B__INCLUDED_
49 #endif // _MSC_VER > 1000
51 #include "cvstreams.h"
52 #include "iCamShift.h"
53 #include "CamShiftUIDs.h"
55 #define SafeRelease(p) { if( (p) != 0 ) { (p)->Release(); (p)= 0; } }
56 #define WM_GRAPHNOTIFY WM_USER+13
59 /////////////////////////////////////////////////////////////////////////////
62 class CBar : public CDialogBar
66 CBar(); // standard constructor
68 ReadParamsFromControls( CvCamShiftParams& params );
69 WriteParamsToControls( CvCamShiftParams& params );
73 enum { IDD = IDD_BAR };
80 BOOL m_ShowBackProject;
85 // ClassWizard generated virtual function overrides
88 virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
94 // Generated message map functions
96 afx_msg void OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
97 afx_msg void OnPicture();
98 afx_msg void OnBackProject();
99 afx_msg void OnHistogram();
101 DECLARE_MESSAGE_MAP()
104 class CMainFrame : public CFrameWnd
106 protected: // create from serialization only
108 DECLARE_DYNCREATE(CMainFrame)
112 ICamShift* m_CamShiftProp;
118 // ClassWizard generated virtual function overrides
119 //{{AFX_VIRTUAL(CMainFrame)
120 virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
125 virtual ~CMainFrame();
127 virtual void AssertValid() const;
128 virtual void Dump(CDumpContext& dc) const;
131 CRect StartTrackerInit();
132 void EndTrackerInit( CRect r );
133 void UpdateThreshold();
137 bool CreateFilterGraph();
138 void ClearFilterGraph();
139 void DestroyFilterGraph();
140 bool CreateCamShift();
141 bool CreateCamera( int idx=0 );
142 void CreateBouncingBall();
143 void SetVideoWindowSize();
144 CRect GetVideoWindowSize();
145 void GetScaleFactor( int& sx, int &sy );
147 protected: // control bar embedded members
148 CStatusBar m_wndStatusBar;
149 CToolBar m_wndToolBar;
154 // DirectShow interface pointers
155 IGraphBuilder* m_GraphBuilder;
156 IMediaControl* m_MediaControl;
157 IVideoWindow* m_VideoWindow;
158 IFilterGraph* m_FilterGraph;
159 IMediaEventEx* m_MediaEventEx;
160 IBaseFilter* m_SourceFilter;
161 IBaseFilter* m_CamShift;
163 // Generated message map functions
165 //{{AFX_MSG(CMainFrame)
166 afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
167 afx_msg void OnDestroy();
168 afx_msg void OnSize(UINT nType, int cx, int cy);
169 afx_msg void OnCamera();
170 afx_msg void OnBall();
171 afx_msg void OnFile();
172 afx_msg void OnPlayPause();
173 afx_msg void OnUpdateCamera(CCmdUI* pCmdUI);
174 afx_msg void OnUpdateBall(CCmdUI* pCmdUI);
175 afx_msg void OnUpdateFile(CCmdUI* pCmdUI);
176 afx_msg void OnUpdatePlayPause(CCmdUI* pCmdUI);
178 DECLARE_MESSAGE_MAP()
181 /////////////////////////////////////////////////////////////////////////////
183 //{{AFX_INSERT_LOCATION}}
184 // Microsoft Visual C++ will insert additional declarations immediately before the previous line.
186 #endif // !defined(AFX_MAINFRM_H__A510D781_2548_11D3_8C73_00A0C998A94B__INCLUDED_)