Panda3D
webcamVideoCursorOpenCV.h
Go to the documentation of this file.
1 /**
2  * PANDA 3D SOFTWARE
3  * Copyright (c) Carnegie Mellon University. All rights reserved.
4  *
5  * All use of this software is subject to the terms of the revised BSD
6  * license. You should have received a copy of this license along
7  * with this source code in a file named "LICENSE."
8  *
9  * @file webcamVideoCursorOpenCV.h
10  * @author drose
11  * @date 2010-10-20
12  */
13 
14 #ifndef WEBCAMVIDEOCURSOROPENCV_H
15 #define WEBCAMVIDEOCURSOROPENCV_H
16 
17 #include "pandabase.h"
18 
19 #ifdef HAVE_OPENCV
20 
21 #include "webcamVideo.h"
22 #include "movieVideoCursor.h"
23 
24 class WebcamVideoOpenCV;
25 struct CvCapture;
26 
27 /**
28  * The Video4Linux implementation of webcams.
29  */
30 class WebcamVideoCursorOpenCV : public MovieVideoCursor {
31 public:
32  WebcamVideoCursorOpenCV(WebcamVideoOpenCV *src);
33  virtual ~WebcamVideoCursorOpenCV();
34  virtual PT(Buffer) fetch_buffer();
35 
36 private:
37  bool get_frame_data(const unsigned char *&r,
38  const unsigned char *&g,
39  const unsigned char *&b,
40  int &x_pitch, int &y_pitch);
41 
42  CvCapture *_capture;
43 
44 public:
45  static TypeHandle get_class_type() {
46  return _type_handle;
47  }
48  static void init_type() {
49  MovieVideoCursor::init_type();
50  register_type(_type_handle, "WebcamVideoCursorOpenCV",
51  MovieVideoCursor::get_class_type());
52  }
53  virtual TypeHandle get_type() const {
54  return get_class_type();
55  }
56  virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
57 
58 private:
59  static TypeHandle _type_handle;
60 };
61 
62 #endif // HAVE_OPENCV
63 
64 #endif
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void register_type(TypeHandle &type_handle, const std::string &name)
This inline function is just a convenient way to call TypeRegistry::register_type(),...
Definition: register_type.I:22
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
Definition: buffer.h:24
A MovieVideo is actually any source that provides a sequence of video frames.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:81