// camera control
#ifndef __CAMERA
#define __CAMERA

#include <wx/wx.h>
#include <wx/panel.h>
#include <wx/config.h>   // wxconfig
#include <cv.h>          // opencv
#include <highgui.h>     // opencv

#define ID_CAMERA          500
#define CMD_CAMERA_ON      ID_CAMERA+1
#define CMD_CAMERA_CAPTURE ID_CAMERA+2

class clsCamera:public wxPanel {
	public:
		clsCamera(wxPanel*);
		wxPanel*    m_panel;
		void        Capture();                         // captures a frame
		void        Display();                         // display the image
		void        cmdCameraOnOff(wxCommandEvent&);   // turn the camera on/off
		void        cmdCameraCapture(wxCommandEvent&); // capture one frame
		IplImage*   GetImage();                        // return the pointer to the captured image

	private:
		wxConfigBase* config;
		CvCapture*  capture;            // opencv capture
		wxButton*   btn_camera_on;      // button to turn the camera on/off
		wxButton*   btn_camera_capture; // capture one frame
		bool        camera_on;          // is the camera on?
		IplImage*   img_main;           // captured ipl image
		int         width, height;      // captured image width/height
};
#endif
