Frapper  1.0a
VideoSource.h
Go to the documentation of this file.
1 /*
2 -----------------------------------------------------------------------------
3 This source file is part of FRAPPER
4 research.animationsinstitut.de
5 sourceforge.net/projects/frapper
6 
7 Copyright (c) 2008-2012 Filmakademie Baden-Wuerttemberg, Institute of Animation
8 
9 This program is free software; you can redistribute it and/or modify it under
10 the terms of the GNU Lesser General Public License as published by the Free Software
11 Foundation; version 2.1 of the License.
12 
13 This program is distributed in the hope that it will be useful, but WITHOUT
14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
15 FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
16 
17 You should have received a copy of the GNU Lesser General Public License along with
18 this program; if not, write to the Free Software Foundation, Inc., 59 Temple
19 Place - Suite 330, Boston, MA 02111-1307, USA, or go to
20 http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html
21 -----------------------------------------------------------------------------
22 */
23 
33 #ifndef VIDEOSOURCE_H
34 #define VIDEOSOURCE_H
35 
36 #ifdef _WIN32
37 #include "cv.h" // from OpenCV
38 #include "cxcore.h" // from OpenCV
39 #include "highgui.h" // from OpenCV, for CvCapture, cvReleaseCapture, cvCaptureFromCAM, cvGrabFrame, cvRetrieveFrame, ...
40 #endif
41 #ifdef _OSX
42 #include <cv.h>
43 #include <cxcore.h>
44 #include <highgui.h>
45 #endif
46 #ifdef _LINUX
47 #include <opencv/highgui.h>
48 #include <opencv/cxcore.h>
49 #include <opencv/cv.h>
50 #endif
51 
52 namespace ImageFilterNode {
53 using namespace cv;
54 
59 {
60 public: //constructors and destructors
65  VideoSource(int camid);
66 
70  ~VideoSource();
71 
72 public: // Public Methods
73 
79  static bool checkCamera(int camid);
80 
85  Mat getNewColorImage();
86 
91  Mat getNewGrayImage();
92 
97  Mat getNewRawImage();
98 
104  void getRawAndColorImage(Mat &colorimage, Mat &raw);
105 
109  bool isCamAvailable();
110 
114  double getFPS();
115 
116 private: //data
132  VideoCapture* cap;
137 };
138 
139 } // namespace ImageFilterNode
140 
141 #endif