ViSP  2.7.0
vpOpenCVGrabber.h
1 /****************************************************************************
2  *
3  * $Id: vpOpenCVGrabber.h 4056 2013-01-05 13:04:42Z fspindle $
4  *
5  * This file is part of the ViSP software.
6  * Copyright (C) 2005 - 2013 by INRIA. All rights reserved.
7  *
8  * This software is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU General Public License
10  * ("GPL") version 2 as published by the Free Software Foundation.
11  * See the file LICENSE.txt at the root directory of this source
12  * distribution for additional information about the GNU GPL.
13  *
14  * For using ViSP with software that can not be combined with the GNU
15  * GPL, please contact INRIA about acquiring a ViSP Professional
16  * Edition License.
17  *
18  * See http://www.irisa.fr/lagadic/visp/visp.html for more information.
19  *
20  * This software was developed at:
21  * INRIA Rennes - Bretagne Atlantique
22  * Campus Universitaire de Beaulieu
23  * 35042 Rennes Cedex
24  * France
25  * http://www.irisa.fr/lagadic
26  *
27  * If you have questions regarding the use of this file, please contact
28  * INRIA at visp@inria.fr
29  *
30  * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
31  * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
32  *
33  *
34  * Description:
35  * Cameras video capture using OpenCV library.
36  *
37  * Authors:
38  * Nicolas Melchior
39  *
40  *****************************************************************************/
41 
47 #ifndef vpOpenCVGrabber_h
48 #define vpOpenCVGrabber_h
49 
50 #include <visp/vpConfig.h>
51 
52 #if defined(VISP_HAVE_OPENCV)
53 
54 #if VISP_HAVE_OPENCV_VERSION >= 0x020101
55 # include <opencv2/highgui/highgui.hpp>
56 #else
57 # include <highgui.h>
58 #endif
59 
60 #include <visp/vpImage.h>
61 #include <visp/vpFrameGrabber.h>
62 #include <visp/vpRGBa.h>
63 
155 class VISP_EXPORT vpOpenCVGrabber : public vpFrameGrabber
156 {
157  private:
158 
159  CvCapture *capture;
160  int DeviceType;
161  bool flip;
162 
163  public:
164 
165  vpOpenCVGrabber();
166  ~vpOpenCVGrabber();
167 
168  void open();
169  void open(vpImage<unsigned char> &I);
170  void open(vpImage<vpRGBa> &I);
171 
173  void acquire(vpImage<vpRGBa> &I);
174  IplImage* acquire();
175 
176  void close();
177 
178  void getFramerate(double & framerate);
179  void setFramerate(const double framerate);
180 
181  void setWidth(const unsigned int width);
182  void setHeight(const unsigned int height);
183 
184  void setDeviceType(int type);
185 
186  void setFlip(bool flipType);
187 };
188 
189 #endif
190 #endif
virtual void open(vpImage< unsigned char > &I)=0
Base class for all video devices. It is designed to provide a front end to video sources.
virtual void close()=0
virtual void acquire(vpImage< unsigned char > &I)=0
Class for cameras video capture using OpenCV library.