MRPT logo

mrpt::hwdrivers::CCameraSensor Class Reference

A container of different camera grabbers under the MRPT's "generic sensor" implementation. More...

#include <mrpt/hwdrivers/CCameraSensor.h>

Inheritance diagram for mrpt::hwdrivers::CCameraSensor:

mrpt::utils::CDebugOutputCapable mrpt::hwdrivers::CGenericSensor mrpt::utils::CUncopiable

List of all members.

Public Member Functions

 CCameraSensor ()
 Constructor The camera is not open until "initialize" is called.
virtual ~CCameraSensor ()
 Destructor.
void doProcess ()
 This method should be called periodically (at least at 1Hz to capture ALL the real-time data) It is thread safe, i.e.
void loadConfig (const mrpt::utils::CConfigFileBase &configSource, const std::string &iniSection)
 Loads specific configuration for the device from a given source of configuration parameters, for example, an ".ini" file, loading from the section "[iniSection]" (see utils::CConfigFileBase and derived classes) See hwdrivers::CCameraSensor for the possible parameters.
virtual void initialize ()
 Tries to open the camera, after setting all the parameters with a call to loadConfig.
void close ()
 Close the camera (if open).
void setPathForExternalImages (const std::string &directory)
 Set the path where to save off-rawlog images: empty (default) means save images embedded in the rawlog.
void setExternalImageFormat (const std::string &ext)
 Set the extension ("jpg","gif","png",.

Protected Attributes

poses::CPose3D m_sensorPose
std::string m_sensorLabel
std::string m_grabber_type
 Can be "opencv",...
int m_cv_camera_index
std::string m_cv_camera_type
mrpt::vision::TCaptureCVOptions m_cv_options
uint64_t m_dc1394_camera_guid
int m_dc1394_camera_unit
mrpt::vision::TCaptureOptions_dc1394 m_dc1394_options
int m_preview_decimation
std::string m_path_for_external_images
 The path where to save off-rawlog images: empty means save images embedded in the rawlog.
std::string m_external_images_format
 The extension ("jpg","gif","png",...) that determines the format of images saved externally.

Private Attributes

mrpt::vision::CImageGrabber_OpenCVm_cap_cv
mrpt::vision::CImageGrabber_dc1394m_cap_dc1394
int m_preview_counter
mrpt::gui::CDisplayWindowm_preview_win


Detailed Description

A container of different camera grabbers under the MRPT's "generic sensor" implementation.

  PARAMETERS IN THE ".INI"-LIKE CONFIGURATION STRINGS:
 -------------------------------------------------------
   [supplied_section_name]
    grabber_type       = opencv | dc1394   // Select one of two grabber implementations.
    preview_decimation = 0     // N<=0 : No preview; N>0, display 1 out of N captured frames.

    // Options for grabber_type= opencv
    cv_camera_index  = 0       // [opencv] Number of camera to open
    cv_camera_type   = CAMERA_CV_AUTODETECT
    cv_frame_width   = 640     // [opencv] Capture width (not present or set to 0 for default)
    cv_frame_height  = 480     // [opencv] Capture height (not present or set to 0 for default)
    cv_fps           = 15      // [opencv] IEEE1394 cams only: Capture FPS (not present or 0 for default)
    cv_gain          = 0       // [opencv] Camera gain, if available (nor present or set to 0 for default).

    // Options for grabber_type= dc1394
    dc1394_camera_guid   = 0 | 0x11223344    // 0 (or not present): the first camera; A hexadecimal number: The GUID of the camera to open
    dc1394_camera_unit   = 0                            // 0 (or not present): the first camera; 0,1,2,...: The unit number (within the given GUID) of the camera to open (Stereo cameras: 0 or 1)
    dc1394_frame_width  = 640
    dc1394_frame_height = 480
    dc1394_framerate            = 15                                    // eg: 7.5, 15, 30, 60, etc... For posibilities see mrpt::vision::TCaptureOptions_dc1394
    dc1394_mode7         = -1                    // -1: Ignore, i>=0, set to MODE7_i
    dc1394_color_coding = COLOR_CODING_YUV422   // For posibilities see mrpt::vision::TCaptureOptions_dc1394
    dc1394_shutter              = -1    // A value, or -1 (or not present) for not to change this parameter in the camera
    dc1394_gain                 = -1    // A value, or -1 (or not present) for not to change this parameter in the camera
    dc1394_gamma                        = -1    // A value, or -1 (or not present) for not to change this parameter in the camera
    dc1394_brightness   = -1    // A value, or -1 (or not present) for not to change this parameter in the camera
    dc1394_exposure             = -1    // A value, or -1 (or not present) for not to change this parameter in the camera
    dc1394_sharpness            = -1    // A value, or -1 (or not present) for not to change this parameter in the camera
    dc1394_white_balance        = -1    // A value, or -1 (or not present) for not to change this parameter in the camera

    // Pose of the sensor on the robot:
    pose_x=0            ; (meters)
    pose_y=0
    pose_z=0
    pose_yaw=0  ; (Angles in degrees)
    pose_pitch=0
    pose_roll=0

Images can be saved in the "external storage" mode. See setPathForExternalImages and setExternalImageFormat. These methods are called automatically from rawlog-grabber.

Note:
The execution rate (in rawlog-grabber) should be greater than the required capture FPS.

In Linux you may need to execute "chmod 666 /dev/video1394/ * " and "chmod 666 /dev/raw1394" for allowing any user R/W access to firewire cameras.

See also:
mrpt::vision::CImageGrabber_OpenCV, mrpt::vision::CImageGrabber_dc1394, CGenericSensor

Definition at line 98 of file CCameraSensor.h.


Constructor & Destructor Documentation

mrpt::hwdrivers::CCameraSensor::CCameraSensor (  ) 

Constructor The camera is not open until "initialize" is called.

virtual mrpt::hwdrivers::CCameraSensor::~CCameraSensor (  )  [virtual]

Destructor.


Member Function Documentation

void mrpt::hwdrivers::CCameraSensor::close (  ) 

Close the camera (if open).

This method is called automatically on destruction.

void mrpt::hwdrivers::CCameraSensor::doProcess (  )  [virtual]

This method should be called periodically (at least at 1Hz to capture ALL the real-time data) It is thread safe, i.e.

you can call this from one thread, then to other methods from other threads.rip

This method processes data from the GPS and update the object state accordingly.

Implements mrpt::hwdrivers::CGenericSensor.

virtual void mrpt::hwdrivers::CCameraSensor::initialize (  )  [virtual]

Tries to open the camera, after setting all the parameters with a call to loadConfig.

Exceptions:
This method must throw an exception with a descriptive message if some critical error is found.

Reimplemented from mrpt::hwdrivers::CGenericSensor.

void mrpt::hwdrivers::CCameraSensor::loadConfig ( const mrpt::utils::CConfigFileBase configSource,
const std::string &  iniSection 
) [virtual]

Loads specific configuration for the device from a given source of configuration parameters, for example, an ".ini" file, loading from the section "[iniSection]" (see utils::CConfigFileBase and derived classes) See hwdrivers::CCameraSensor for the possible parameters.

Implements mrpt::hwdrivers::CGenericSensor.

void mrpt::hwdrivers::CCameraSensor::setExternalImageFormat ( const std::string &  ext  )  [inline]

Set the extension ("jpg","gif","png",.

..) that determines the format of images saved externally The default is "jpg".

See also:
setPathForExternalImages

Definition at line 147 of file CCameraSensor.h.

void mrpt::hwdrivers::CCameraSensor::setPathForExternalImages ( const std::string &  directory  ) 

Set the path where to save off-rawlog images: empty (default) means save images embedded in the rawlog.

Exceptions:
std::exception If the directory cannot be created


Member Data Documentation

Definition at line 172 of file CCameraSensor.h.

Definition at line 175 of file CCameraSensor.h.

Definition at line 157 of file CCameraSensor.h.

Definition at line 158 of file CCameraSensor.h.

Definition at line 159 of file CCameraSensor.h.

Definition at line 161 of file CCameraSensor.h.

Definition at line 162 of file CCameraSensor.h.

Definition at line 163 of file CCameraSensor.h.

The extension ("jpg","gif","png",...) that determines the format of images saved externally.

See also:
setPathForExternalImages

Definition at line 168 of file CCameraSensor.h.

Can be "opencv",...

Definition at line 156 of file CCameraSensor.h.

The path where to save off-rawlog images: empty means save images embedded in the rawlog.

Definition at line 167 of file CCameraSensor.h.

Definition at line 177 of file CCameraSensor.h.

Definition at line 164 of file CCameraSensor.h.

Definition at line 178 of file CCameraSensor.h.

Definition at line 154 of file CCameraSensor.h.

Definition at line 153 of file CCameraSensor.h.




Page generated by Doxygen 1.5.9 for MRPT 0.6.5 SVN:exported at Thu May 21 04:14:55 UTC 2009