orca-robotics INTRODUCTION Overview Download and Install Documentation REPOSITORY Interfaces Drivers Libraries Utilities Software Map DEVELOPER Dashboard PEOPLE Contributors Users Project Download Mailing lists
|
cameraopencv/driver.h00001 /* 00002 * Orca-Robotics Project: Components for robotics 00003 * http://orca-robotics.sf.net/ 00004 * Copyright (c) 2004-2008 Tom Burdick, Alex Brooks, Alexei Makarenko, Tobias Kaupp 00005 * 00006 * This distribution is licensed to you under the terms described in 00007 * the LICENSE file included in this distribution. 00008 * 00009 */ 00010 00011 #ifndef HYDRO_CAMERA_OPENCV_H 00012 #define HYDRO_CAMERA_OPENCV_H 00013 00014 #include <hydrointerfaces/camera.h> 00015 #include <opencv/cv.h> 00016 #include <opencv/highgui.h> 00017 00018 namespace cameraopencv { 00019 00020 // 00021 // Bogus image driver, useful for testing the rest of the component. 00022 // 00023 class Driver : public hydrointerfaces::Camera 00024 { 00025 00026 public: 00027 00028 Driver( const Config &cfg, const hydroutil::Context &context ); 00029 virtual ~Driver(); 00030 00031 // Blocks til new data is available 00032 virtual void read( hydrointerfaces::Camera::Data &data ); 00033 00034 virtual uint32_t availableCameras() { return 10; } 00035 00036 virtual std::vector<hydroimage::ImageFormat> cameraImageFormats(uint32_t id) { std::vector <hydroimage::ImageFormat> formats; formats.push_back(hydroimage::ImageFormatModeBGR8); return formats; } 00037 00038 private: 00039 00040 Camera::Config config_; 00041 hydroutil::Context context_; 00042 00043 std::vector<CvCapture*> cameras_; 00044 std::vector<IplImage*> frames_; 00045 00046 IplImage* tempImg_; 00047 }; 00048 00049 // Used for dynamically loading driver 00050 class Factory : public hydrointerfaces::CameraFactory 00051 { 00052 public: 00053 hydrointerfaces::Camera *createDriver( 00054 const hydrointerfaces::Camera::Config &config, 00055 const hydroutil::Context &context ) const 00056 { 00057 return new Driver( config, context ); 00058 } 00059 }; 00060 00061 } // namespace 00062 00063 // Used for dynamically loading driver 00064 extern "C" { 00065 hydrointerfaces::CameraFactory *createDriverFactory(); 00066 } 00067 00068 #endif |
Webmaster: Tobias Kaupp (tobasco at users.sourceforge.net)