Go to the documentation of this file.00001
00002
00003
00043 #pragma once
00044
00045
00046 #include <cv.h>
00047 #include <highgui.h>
00048 #include <Vfw.h>
00049 #include "afxwin.h"
00050 #include "atltypes.h"
00051 #include "afxcmn.h"
00052
00053 #include "CommThread.h"
00054
00055 #include "TUIO.h"
00056
00057
00058 #define CAMERA 0
00059 #define UART 1
00060
00061 #define MAX_BUFFER_SIZE 1200
00062 #define DATA_WIDTH 40
00063 #define DATA_HEIGHT 30
00064
00065
00066
00067 #if(_DEBUG)
00068 #define DEBUG printf
00069 #else
00070 #define DEBUG (void)
00071 #endif
00072
00073
00074
00075
00076 class CsimplemtDlg : public CDialog
00077 {
00078
00079 public:
00080 CsimplemtDlg(CWnd* pParent = NULL);
00081
00082
00083 enum { IDD = IDD_SIMPLEMT_DIALOG };
00084
00085 protected:
00086 virtual void DoDataExchange(CDataExchange* pDX);
00087
00088
00089
00090 protected:
00091 HICON m_hIcon;
00092
00093
00094 virtual BOOL OnInitDialog();
00095 afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
00096 afx_msg void OnPaint();
00097 afx_msg HCURSOR OnQueryDragIcon();
00098 afx_msg long OnCommunication(WPARAM wParam, LPARAM lParam);
00099 DECLARE_MESSAGE_MAP()
00100
00101 public:
00102 void DisplayFunctionSpeed()
00103 {
00104
00105
00106
00107
00108 }
00109
00110 public:
00111 CDC m_MemDC;
00112 CBitmap m_MemBitmap;
00113 CDC m_LogoDC;
00114 CBitmap m_LogoBitmap;
00115
00116 FILE *m_fpSensorData;
00117
00118 CStatic m_stSourceImage;
00119 CStatic m_stGrayImage;
00120 CStatic m_stResizedSensorData;
00121 CStatic m_stOffset;
00122 CStatic m_stDiff;
00123 CStatic m_stSmoothing;
00124 CStatic m_stSmoothing2;
00125 CStatic m_stHighpass;
00126 CStatic m_stAmplification;
00127 CStatic m_stBW;
00128 CStatic m_stLabeling;
00129 CStatic m_stMtPicture;
00130
00131 IplImage* m_pColorSourceImage;
00132 IplImage* m_pcSourceImage;
00133 IplImage* m_pSourceDisplayImage;
00134 IplImage* m_pGraySourceImage;
00135 IplImage* m_pResizedSensorData;
00136 IplImage* m_pOffset;
00137 IplImage* m_pDiff;
00138 IplImage* m_pSmoothing;
00139 IplImage* m_pSmoothing2;
00140 IplImage* m_pHighpass;
00141 IplImage* m_pAmplification;
00142 IplImage* m_pBW;
00143 IplImage* m_pLabeling;
00144 IplImage* m_pMtPicture;
00145 IplImage* m_pTransformedMtPicture;
00146
00147 CvvImage m_cOffset;
00148 CvvImage m_cDiff;
00149 CvvImage m_cSourceImage;
00150 CvvImage m_cGrayImage;
00151 CvvImage m_cSensorData;
00152 CvvImage m_cHighpass;
00153 CvvImage m_cSmoothing;
00154 CvvImage m_cSmoothing2;
00155 CvvImage m_cAmplification;
00156 CvvImage m_cBW;
00157 CvvImage m_cLabeling;
00158 CvvImage m_cMtPicture;
00159
00160 CvSize m_cSensorDisplaySize;
00161 CvSize m_cResizedSensorSize;
00162
00163 CString m_strMinSensor;
00164 CString m_strMaxSensor;
00165 CString m_strAvgSensor;
00166 CString m_strMinOffset;
00167 CString m_strMaxOffset;
00168 CString m_strAvgOffset;
00169 CString m_strMinDiff;
00170 CString m_strMaxDiff;
00171 CString m_strAvgDiff;
00172 CString m_strMinAmp;
00173 CString m_strMaxAmp;
00174 CString m_strNumLabel;
00175 CString m_strMinSmoothing;
00176 CString m_strMaxSmoothing;
00177 CString m_strMinHighpass;
00178 CString m_strMaxHighpass;
00179 CString m_strMinSmoothing2;
00180 CString m_strMaxSmoothing2;
00181 CString m_strMinBw;
00182 CString m_strMaxBw;
00183 CString m_strMinBlobSize;
00184 CString m_strMaxBlobSize;
00185
00186 CString m_strTimeResize;
00187 CString m_strTimeDiff;
00188 CString m_strTimeSmoothing;
00189 CString m_strTimeSmoothing2;
00190 CString m_strTimeHighpass;
00191 CString m_strTimeAmplification;
00192 CString m_strTimeBw;
00193 CString m_strTimeLabeling;
00194 CString m_strTimeAlgorithm;
00195 CString m_strConsole;
00196
00197 CEdit m_edtConsole;
00198 CSliderCtrl m_SliderSmoothing;
00199 CSliderCtrl m_SliderMaskSize1;
00200 CSliderCtrl m_SliderAmpcoeff;
00201 CSliderCtrl m_SliderBwth2;
00202 CSliderCtrl m_SliderThMinArea;
00203 CSliderCtrl m_SliderThMaxArea;
00204 CSliderCtrl m_SliderAmpRangeMin;
00205 CSliderCtrl m_SliderAmpRangeMax;
00206 CSliderCtrl m_SliderScaleCol;
00207 CSliderCtrl m_SliderScaleRow;
00208
00209 CString m_strMaskSize;
00210 CString m_strMaskSize1;
00211 CString m_strAmpCoeff;
00212 CString m_strBwTh2;
00213 CString m_strThMinArea;
00214 CString m_strThMaxArea;
00215 CString m_strAmpRangeMin;
00216 CString m_strAmpRangeMax;
00217 CString m_strScaleCol;
00218 CString m_strScaleRow;
00219
00220 BOOL m_bCheckSmoothing;
00221 BOOL m_bCheckSmoothing2;
00222 BOOL m_bCheckHighpass;
00223 BOOL m_bFastMode;
00224
00225
00226 afx_msg void OnTimer(UINT_PTR nIDEvent);
00227 void OnTimer_BasedOnSerial();
00228
00229 afx_msg void OnDestroy();
00230 afx_msg void OnBnClickedOk();
00231 afx_msg void OnBnClickedClear();
00232 afx_msg void OnBnClickedConnect();
00233 afx_msg void OnBnClickedStart();
00234 afx_msg void OnBnClickedStop();
00235 afx_msg void OnBnClickedOffset();
00236 afx_msg void OnBnClickedButtonOpen();
00237 afx_msg void OnBnClickedButtonClose();
00238 afx_msg void OnBnClickedButtonSend();
00239 afx_msg void OnBnClickedRadioUart();
00240 afx_msg void OnBnClickedCheckFlipHorizontal();
00241 afx_msg void OnBnClickedCheckFlipVertical();
00242 afx_msg void OnBnClickedCheckSmoothing();
00243 afx_msg void OnBnClickedCheckSmoothing2();
00244 afx_msg void OnBnClickedCheckHighpass();
00245 afx_msg void OnBnClickedCheckFastMode();
00246 afx_msg void OnBnClickedCheckEventbt();
00247 afx_msg void OnBnClickedButtonConsoleClear();
00248 afx_msg void OnBnClickedButtonGain();
00249 afx_msg void OnBnClickedCheckSendMessages();
00250 afx_msg void OnBnClickedCheckSendTuio();
00251 afx_msg void OnNMReleasedcaptureSliderSmoothing(NMHDR *pNMHDR, LRESULT *pResult);
00252 afx_msg void OnNMReleasedcaptureSliderMasksize1(NMHDR *pNMHDR, LRESULT *pResult);
00253 afx_msg void OnNMReleasedcaptureSliderAmpcoeff(NMHDR *pNMHDR, LRESULT *pResult);
00254 afx_msg void OnNMReleasedcaptureSliderBwth2(NMHDR *pNMHDR, LRESULT *pResult);
00255 afx_msg void OnNMReleasedcaptureSliderThminarea(NMHDR *pNMHDR, LRESULT *pResult);
00256 afx_msg void OnNMReleasedcaptureSliderThmaxarea(NMHDR *pNMHDR, LRESULT *pResult);
00257 afx_msg void OnNMReleasedcaptureSliderArangemin(NMHDR *pNMHDR, LRESULT *pResult);
00258 afx_msg void OnNMReleasedcaptureSliderArangemax(NMHDR *pNMHDR, LRESULT *pResult);
00259 afx_msg void OnNMReleasedcaptureSliderScaleCol(NMHDR *pNMHDR, LRESULT *pResult);
00260 afx_msg void OnNMReleasedcaptureSliderScaleRow(NMHDR *pNMHDR, LRESULT *pResult);
00261 afx_msg void OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
00262
00263
00264
00265 void DrawAllImages(void);
00266 void DrawTouchEvent(void);
00267 void DrawIplImageToHDC(IplImage * pIplImage, CStatic * pStatic, CvvImage * pCvvImage);
00268 void DrawResizedIplImageToHDC(IplImage * src, IplImage * dst, CStatic * pStatic, CvvImage * pCvvImage);
00269
00270 void DisplayRunsmt(void);
00271 void ResizeDataProcessingImage(int nrow_resize, int ncol_resize);
00272
00273 void DefineImageFlip(void);
00274
00275 int m_FlipMode;
00276 bool m_bDoFlip;
00277 BOOL m_bFlipHorizontal;
00278 BOOL m_bFlipVertical;
00279 BOOL m_bSendWindowsMessages;
00280
00281 CRect m_rectTouchEvent;
00282
00283 CString m_strScale;
00284 CString m_strRotate;
00285 float m_RotationAngle;
00286 float m_SizeScale;
00287
00288 CEdit m_cEditStatus;
00289 int m_nEditFPSms;
00290 float m_fEditFPSHz;
00291 float m_fEditGain;
00292 int m_nEditMin;
00293 int m_nEditMax;
00294 float m_fEditcMin;
00295 float m_fEditcMax;
00296
00297
00298
00299
00300
00301 public:
00302 void initcvImagedata();
00303 void initControlSetting();
00304 void initConsoleWindowSetting();
00305 void initTUIOSetting();
00306 void initSerialSetting();
00307 void initResImageSetting();
00308
00309
00310
00311
00312
00313 public:
00314 IplImage* Res2IplImage(HBITMAP hbmp);
00315
00316
00317
00318
00319
00320
00321 public:
00322 TUIO m_TUIO;
00323 bool m_bSendTUIO;
00324
00325
00326
00327
00328 public:
00329 PBYTE m_pBuffer;
00330 BYTE m_byOffsetData[MAX_BUFFER_SIZE];
00331
00332 int m_nEditDataROW;
00333 int m_nEditDataCOL;
00334
00335 CCommThread m_Comm;
00336 int m_nCommType;
00337 int m_nPacketSize ;
00338
00339 bool m_bIsOffsetOn;
00340 bool m_bPortInit;
00341
00342 CComboBox m_cbPORT;
00343 CComboBox m_cbBAUD;
00344 CComboBox m_cbDATA;
00345 CComboBox m_cbSTOP;
00346 CComboBox m_cbPARITY;
00347
00348 int m_ncbPort;
00349 int m_ncbBaud;
00350 int m_ncbData;
00351 int m_ncbStop;
00352 int m_ncbParity;
00353
00354 CString m_strSend;
00355
00356
00357 };