Panda3D

webcamVideoCursorOpenCV.h

00001 // Filename: webcamVideoCursorOpenCV.h
00002 // Created by:  drose (20Oct10)
00003 //
00004 ////////////////////////////////////////////////////////////////////
00005 //
00006 // PANDA 3D SOFTWARE
00007 // Copyright (c) Carnegie Mellon University.  All rights reserved.
00008 //
00009 // All use of this software is subject to the terms of the revised BSD
00010 // license.  You should have received a copy of this license along
00011 // with this source code in a file named "LICENSE."
00012 //
00013 ////////////////////////////////////////////////////////////////////
00014 
00015 #ifndef WEBCAMVIDEOCURSOROPENCV_H
00016 #define WEBCAMVIDEOCURSOROPENCV_H
00017 
00018 #include "pandabase.h"
00019 
00020 #ifdef HAVE_OPENCV
00021 
00022 #include "webcamVideo.h"
00023 
00024 class WebcamVideoOpenCV;
00025 
00026 ////////////////////////////////////////////////////////////////////
00027 //       Class : WebcamVideoCursorOpenCV
00028 // Description : The Video4Linux implementation of webcams.
00029 ////////////////////////////////////////////////////////////////////
00030 class WebcamVideoCursorOpenCV : public MovieVideoCursor {
00031 public:
00032   WebcamVideoCursorOpenCV(WebcamVideoOpenCV *src);
00033   virtual ~WebcamVideoCursorOpenCV();
00034   virtual PT(Buffer) fetch_buffer();
00035 
00036 private:
00037   bool get_frame_data(const unsigned char *&r,
00038                       const unsigned char *&g,
00039                       const unsigned char *&b,
00040                       int &x_pitch, int &y_pitch);
00041 
00042   CvCapture *_capture;
00043 
00044 public:
00045   static TypeHandle get_class_type() {
00046     return _type_handle;
00047   }
00048   static void init_type() {
00049     MovieVideoCursor::init_type();
00050     register_type(_type_handle, "WebcamVideoCursorOpenCV",
00051                   MovieVideoCursor::get_class_type());
00052   }
00053   virtual TypeHandle get_type() const {
00054     return get_class_type();
00055   }
00056   virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
00057 
00058 private:
00059   static TypeHandle _type_handle;
00060 };
00061 
00062 #endif // HAVE_OPENCV
00063 
00064 #endif
 All Classes Functions Variables Enumerations