root / branches / test / PS3Capture / PS3Capture / PS3.h @ 6
View | Annotate | Download (2.3 KB)
| 1 | // --------------------------------------------------------
|
|---|---|
| 2 | //! PS3.h
|
| 3 | //
|
| 4 | //
|
| 5 | // Author: Yishi Guo
|
| 6 | // Create Date: 2011-05-12
|
| 7 | // Update: 2011-05-14 by Yishi Guo
|
| 8 | // Add capture and show functions
|
| 9 | // --------------------------------------------------------
|
| 10 | |
| 11 | #ifndef _PS3_H_
|
| 12 | #define _PS3_H_
|
| 13 | |
| 14 | #include "CLEyeMulticam.h" |
| 15 | #include <string> |
| 16 | #include <sstream> |
| 17 | #include <cv.h> |
| 18 | #include <highgui.h> |
| 19 | |
| 20 | using namespace std; |
| 21 | |
| 22 | class PS3 {
|
| 23 | public:
|
| 24 | //! Constructor
|
| 25 | PS3(); |
| 26 | |
| 27 | //! Destructor
|
| 28 | ~PS3(); |
| 29 | |
| 30 | //! Get the camera count
|
| 31 | /*!
|
| 32 | \return the camera count |
| 33 | */ |
| 34 | static int GetCameraCount(); |
| 35 | |
| 36 | //! Convert GUID to string
|
| 37 | /*!
|
| 38 | \param guid a GUID structure param |
| 39 | \return string of guid |
| 40 | */ |
| 41 | static std::string GUID2String( GUID guid, char delimiter = '-', bool uppercase = false ); |
| 42 | |
| 43 | //! Get camera GUID by camera Id
|
| 44 | static GUID GetGUID( int camId ); |
| 45 | |
| 46 | //! Get GUID of the camera
|
| 47 | GUID GetGUID() const;
|
| 48 | |
| 49 | //! Set the GUID of camera
|
| 50 | void SetGUID( GUID guid );
|
| 51 | |
| 52 | //!
|
| 53 | static DWORD WINAPI CaptureThread( LPVOID instance );
|
| 54 | |
| 55 | //! Main method to running camera
|
| 56 | void Run();
|
| 57 | |
| 58 | //! Set some values about camera
|
| 59 | void SetCamera( GUID camGUID, CLEyeCameraColorMode colorMode,
|
| 60 | CLEyeCameraResolution camRes, float frameRate);
|
| 61 | |
| 62 | //! Start the camera
|
| 63 | bool StartCamera();
|
| 64 | |
| 65 | //! Stop the camera
|
| 66 | void StopCamera();
|
| 67 | |
| 68 | //! Start the capture
|
| 69 | bool StartCapture();
|
| 70 | |
| 71 | //! Stop the capture
|
| 72 | bool StopCapture();
|
| 73 | |
| 74 | //! Show window or not
|
| 75 | bool ShowWindow( bool bShow ); |
| 76 | |
| 77 | //! Set window show value
|
| 78 | void SetShow( bool bShow ); |
| 79 | |
| 80 | //! Set the window title
|
| 81 | void SetWindowTitle( string title );
|
| 82 | |
| 83 | //! Get the pixels of frame
|
| 84 | unsigned char* GetPixels(); |
| 85 | |
| 86 | private:
|
| 87 | //! GUID of camera
|
| 88 | GUID _camGUID; |
| 89 | |
| 90 | //! Camera color mode
|
| 91 | CLEyeCameraColorMode _camColorMode; |
| 92 | |
| 93 | //! Camera resolution
|
| 94 | CLEyeCameraResolution _camResolution; |
| 95 | |
| 96 | //! Camera frame rate
|
| 97 | float _frameRate;
|
| 98 | |
| 99 | //! PS3 camera instance
|
| 100 | CLEyeCameraInstance _cam; |
| 101 | |
| 102 | //! Is camera running
|
| 103 | bool _bRunning;
|
| 104 | |
| 105 | //! Is capture
|
| 106 | bool _bCapture;
|
| 107 | |
| 108 | //! Is show the window
|
| 109 | bool _bShow;
|
| 110 | |
| 111 | //! The title of window
|
| 112 | string _windowTitle; |
| 113 | |
| 114 | //! Handle of capture thread
|
| 115 | HANDLE _hThread; |
| 116 | |
| 117 | unsigned char* _pCapBuffer; |
| 118 | |
| 119 | //! Is initialized
|
| 120 | bool _bInitialized;
|
| 121 | |
| 122 | }; |
| 123 | #endif |
