Panda3D
webcamVideoCursorOpenCV.h
1 // Filename: webcamVideoCursorOpenCV.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 WEBCAMVIDEOCURSOROPENCV_H
16 #define WEBCAMVIDEOCURSOROPENCV_H
17 
18 #include "pandabase.h"
19 
20 #ifdef HAVE_OPENCV
21 
22 #include "webcamVideo.h"
23 #include "movieVideoCursor.h"
24 
25 class WebcamVideoOpenCV;
26 
27 ////////////////////////////////////////////////////////////////////
28 // Class : WebcamVideoCursorOpenCV
29 // Description : The Video4Linux implementation of webcams.
30 ////////////////////////////////////////////////////////////////////
31 class WebcamVideoCursorOpenCV : public MovieVideoCursor {
32 public:
33  WebcamVideoCursorOpenCV(WebcamVideoOpenCV *src);
34  virtual ~WebcamVideoCursorOpenCV();
35  virtual PT(Buffer) fetch_buffer();
36 
37 private:
38  bool get_frame_data(const unsigned char *&r,
39  const unsigned char *&g,
40  const unsigned char *&b,
41  int &x_pitch, int &y_pitch);
42 
43  CvCapture *_capture;
44 
45 public:
46  static TypeHandle get_class_type() {
47  return _type_handle;
48  }
49  static void init_type() {
50  MovieVideoCursor::init_type();
51  register_type(_type_handle, "WebcamVideoCursorOpenCV",
52  MovieVideoCursor::get_class_type());
53  }
54  virtual TypeHandle get_type() const {
55  return get_class_type();
56  }
57  virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
58 
59 private:
60  static TypeHandle _type_handle;
61 };
62 
63 #endif // HAVE_OPENCV
64 
65 #endif
Definition: buffer.h:26
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