orca-robotics INTRODUCTION Overview Download and Install Documentation REPOSITORY Interfaces Drivers Libraries Utilities Software Map DEVELOPER Dashboard PEOPLE Contributors Users Project Download Mailing lists
|
camerafile/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_FILE_H 00012 #define HYDRO_CAMERA_FILE_H 00013 00014 #include <vector> 00015 #include <string> 00016 00017 #include <hydrointerfaces/camera.h> 00018 00019 #include <opencv/cv.h> 00020 00021 namespace camerafile { 00022 00023 // 00024 // Bogus image driver, useful for testing the rest of the component. 00025 // 00026 class Driver : public hydrointerfaces::Camera 00027 { 00028 00029 public: 00030 00031 Driver( const Config &cfg, const hydroutil::Context &context ); 00032 virtual ~Driver(); 00033 00034 // Blocks till new data is available 00035 virtual void read( hydrointerfaces::Camera::Data &data ); 00036 00037 virtual uint32_t availableCameras() { return 10; } 00038 00039 virtual std::vector<hydroimage::ImageFormat> cameraImageFormats(uint32_t id) { std::vector <hydroimage::ImageFormat> formats; formats.push_back(hydroimage::ImageFormatModeBGR8); return formats; } 00040 00041 private: 00042 00043 Camera::Config config_; 00044 hydroutil::Context context_; 00045 std::vector<std::string> filenames_; 00046 std::vector<IplImage*> images_; 00047 00048 }; 00049 00050 // Used for dynamically loading driver 00051 class Factory : public hydrointerfaces::CameraFactory 00052 { 00053 public: 00054 hydrointerfaces::Camera *createDriver( 00055 const hydrointerfaces::Camera::Config &config, 00056 const hydroutil::Context &context ) const 00057 { 00058 return new Driver( config, context ); 00059 } 00060 }; 00061 00062 } // namespace 00063 00064 // Used for dynamically loading driver 00065 extern "C" { 00066 hydrointerfaces::CameraFactory *createDriverFactory(); 00067 } 00068 00069 #endif |
Webmaster: Tobias Kaupp (tobasco at users.sourceforge.net)