BitmapToolkit Scol plugin
CameraInput.h
Go to the documentation of this file.
1/*
2-----------------------------------------------------------------------------
3This source file is part of OpenSpace3D
4For the latest info, see http://www.openspace3d.com
5
6Copyright (c) 2012 I-maginer
7
8This program is free software; you can redistribute it and/or modify it under
9the terms of the GNU Lesser General Public License as published by the Free Software
10Foundation; either version 2 of the License, or (at your option) any later
11version.
12
13This program is distributed in the hope that it will be useful, but WITHOUT
14ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
15FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
16
17You should have received a copy of the GNU Lesser General Public License along with
18this program; if not, write to the Free Software Foundation, Inc., 59 Temple
19Place - Suite 330, Boston, MA 02111-1307, USA, or go to
20http://www.gnu.org/copyleft/lesser.txt
21
22-----------------------------------------------------------------------------
23*/
24
25#ifndef __BTK_CAMERAINPUT_H__
26#define __BTK_CAMERAINPUT_H__
27
28#include "prerequisites.h"
29
30#ifdef _WIN32
31 #include <videoInput.h>
32#endif
33
34#include <vector>
35#include <opencv2/opencv.hpp>
36#include <cassert>
37
39
40 public:
41 static std::vector<std::string> GetDevicesList();
42 static void SetCameraInputsState(bool state);
43
44 protected:
45 static std::list<CameraInput*> cameraInputsList;
46
47 private:
48
49#ifdef _WIN32
50 videoInput* mVI;
51#else
52 cv::VideoCapture* mVI;
53#endif
54 int mIndex;
55
56 std::vector<unsigned char> mBuffer;
57 bool mMirrorMode;
58 cv::Size mBufferSize;
59 public:
60 CameraInput(int index);
62
63 bool Initialize();
64 void Close();
65 bool IsOpened();
66 cv::Mat UpdateImage();
67
68 int GetWidth();
69 int GetHeight();
70 void SetSize(int width, int height);
71 bool GetMirrorMode();
72 void SetMirrorMode(bool mode);
73
74 // Capture a snapshot of current camera frame and store it to "path"
75 bool TakeSnapshot(std::string path);
76
77 // Render current frame to screen using android stuff
78 void RenderToScreen();
79
80 protected:
81
82 private:
84
85};
86
87#endif
static std::vector< std::string > GetDevicesList()
cv::Mat UpdateImage()
void SetSize(int width, int height)
void SetMirrorMode(bool mode)
static std::list< CameraInput * > cameraInputsList
Definition CameraInput.h:45
static void SetCameraInputsState(bool state)
bool GetMirrorMode()
bool TakeSnapshot(std::string path)
void RenderToScreen()
bool Initialize()