Panda3D
webcamVideoOpenCV.h
1 // Filename: webcamVideoOpenCV.h
2 // Created by: drose (20Oct10)
3 //
4 ////////////////////////////////////////////////////////////////////
5 //
6 // PANDA 3D SOFTWARE
7 // Copyright (c) Carnegie Mellon University. All rights reserved.
8 //
9 // All use of this software is subject to the terms of the revised BSD
10 // license. You should have received a copy of this license along
11 // with this source code in a file named "LICENSE."
12 //
13 ////////////////////////////////////////////////////////////////////
14 
15 #ifndef WEBCAMVIDEOOPENCV_H
16 #define WEBCAMVIDEOOPENCV_H
17 
18 #include "pandabase.h"
19 
20 #ifdef HAVE_OPENCV
21 
22 #include "webcamVideo.h"
23 
24 class WebcamVideoCursorOpenCV;
25 
26 ////////////////////////////////////////////////////////////////////
27 // Class : WebcamVideoOpenCV
28 // Description : The OpenCV implementation of webcams. Probably won't
29 // be needed once we have a native webcam implementation
30 // for each Panda3D-supported platform. (So far, we're
31 // 2 for 3.)
32 ////////////////////////////////////////////////////////////////////
33 class WebcamVideoOpenCV : public WebcamVideo {
34 private:
35  WebcamVideoOpenCV(int camera_index);
36  virtual PT(MovieVideoCursor) open();
37 
38 private:
39  int _camera_index;
40 
41 public:
42  static TypeHandle get_class_type() {
43  return _type_handle;
44  }
45  static void init_type() {
46  WebcamVideo::init_type();
47  register_type(_type_handle, "WebcamVideoOpenCV",
48  WebcamVideo::get_class_type());
49  }
50  virtual TypeHandle get_type() const {
51  return get_class_type();
52  }
53  virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
54 
55 private:
56  static TypeHandle _type_handle;
57 
58  friend class WebcamVideoCursorOpenCV;
59  friend void find_all_webcams_opencv();
60 };
61 
62 #endif // HAVE_OPENCV
63 
64 #endif
Allows you to open a webcam or other video capture device as a video stream.
Definition: webcamVideo.h:25
A MovieVideo is actually any source that provides a sequence of video frames.
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:85