claraty::A_Camera Class Reference
#include <a_camera.h>
Inheritance diagram for claraty::A_Camera:


Public Types | |
| enum | IMAGE_FORMAT { MONO8, YUV411, YUV422, YUV444, RGB8, MONO16, RGB16 } |
Public Member Functions | |
| virtual bool | io (FDM_Map map) |
| int | get_width () const |
| int | get_height () const |
| void | acquire (Image< uint8_t > &image, Time *timestamp_ptr=NULL, Feature_Map *feature_map_ptr=NULL) throw (std::exception) |
| void | acquire (Image< uint16_t > &image, Time *timestamp_ptr=NULL, Feature_Map *feature_map_ptr=NULL) throw (std::exception) |
| void | set_camera_model_ptr (Camera_Model *cm) |
| const Camera_Model * | get_camera_model_ptr () const |
| virtual bool | set_contrast (double gain_proportion=DONT_CARE) |
| virtual double | get_contrast () const |
| virtual bool | set_brightness (double offset=DONT_CARE) |
| virtual double | get_brightness () const |
| virtual bool | set_exposure (double seconds=DONT_CARE) |
| virtual double | get_exposure () const |
| virtual bool | set_format (IMAGE_FORMAT format, int width_pixels=-1, int height_pixels=-1) |
| virtual IMAGE_FORMAT | get_format () const |
| virtual bool | set_subframe (int width_offset, int height_offset, int width, int height) |
| virtual int | get_subframe_width_offset () const |
| virtual int | get_subframe_height_offset () const |
| virtual int | get_subframe_width () const |
| virtual int | get_subframe_height () const |
| template<class Pixel_Type> | |
| void | acquire (Camera_Image< Pixel_Type > &image) throw (std::exception) |
| Acquire a Camera_Image (template version). | |
| bool | on () |
| bool | off () |
| bool | is_on () |
| void | set_power_switch (Power_Switch &sw) |
| std::string | get_name () const |
| std::ostream & | display_xml (const char *p, std::ostream &os=std::cout) const |
Static Public Attributes | |
| static const double | DONT_CARE = -DOUBLE_EPSILON |
Protected Member Functions | |
| void | _verify_pixel_format (size_t pixel_size) |
| template<class Pixel_Type> | |
| void | _verify_resize_image (Image< Pixel_Type > &image) |
Protected Attributes | |
| Camera_Model * | _camera_model_ptr |
| std::string | _name |
| Power_Switch * | _power_switch |
Detailed Description
Definition at line 33 of file a_camera.h.
Member Enumeration Documentation
enum claraty::Camera::IMAGE_FORMAT [inherited] |
Constructor & Destructor Documentation
| claraty::A_Camera::A_Camera | ( | const char * | filename | ) | [inline] |
| claraty::A_Camera::A_Camera | ( | const char * | filename | ) | [inline] |
Member Function Documentation
| int claraty::A_Camera::get_width | ( | ) | const [inline, virtual] |
| int claraty::A_Camera::get_height | ( | ) | const [inline, virtual] |
| void claraty::A_Camera::acquire | ( | Image< uint8_t > & | image, | |
| Time * | timestamp_ptr = NULL, |
|||
| Feature_Map * | feature_map_ptr = NULL | |||
| ) | throw (std::exception) [virtual] |
[description]
- Parameters:
-
[in] image [in] timestamp_ptr [in] feature_map_ptr
Implements claraty::Camera.
Definition at line 39 of file a_camera.cc.
00042 { 00043 image.resize(1024, 1024); 00044 for(int x = 0; x < image.get_width(); ++x) { 00045 for(int y = 0; y < image.get_height(); ++y) { 00046 image(x, y) = x * y % 256; 00047 } 00048 } 00049 cout << image; 00050 }
| void claraty::A_Camera::acquire | ( | Image< uint16_t > & | image, | |
| Time * | timestamp_ptr = NULL, |
|||
| Feature_Map * | feature_map_ptr = NULL | |||
| ) | throw (std::exception) [virtual] |
[description]
- Parameters:
-
[in] image [in] timestamp_ptr [in] feature_map_ptr
Implements claraty::Camera.
Definition at line 61 of file a_camera.cc.
00064 { 00065 image.resize(1024, 1024); 00066 for(int x = 0; x < image.get_width(); ++x) { 00067 for(int y = 0; y < image.get_height(); ++y) { 00068 image(x, y) = x * y % 65536; 00069 } 00070 } 00071 }
| void claraty::Camera::set_camera_model_ptr | ( | Camera_Model * | cm | ) | [inline, inherited] |
Definition at line 141 of file camera.h.
References claraty::Camera::_camera_model_ptr.
00141 {_camera_model_ptr = cm;}
| const Camera_Model* claraty::Camera::get_camera_model_ptr | ( | ) | const [inline, inherited] |
Definition at line 143 of file camera.h.
References claraty::Camera::_camera_model_ptr.
00144 { 00145 return _camera_model_ptr; 00146 }
| virtual bool claraty::Camera::set_contrast | ( | double | gain_proportion = DONT_CARE |
) | [inline, virtual, inherited] |
| virtual double claraty::Camera::get_contrast | ( | ) | const [inline, virtual, inherited] |
| virtual bool claraty::Camera::set_brightness | ( | double | offset = DONT_CARE |
) | [inline, virtual, inherited] |
| virtual double claraty::Camera::get_brightness | ( | ) | const [inline, virtual, inherited] |
| virtual bool claraty::Camera::set_exposure | ( | double | seconds = DONT_CARE |
) | [inline, virtual, inherited] |
| virtual double claraty::Camera::get_exposure | ( | ) | const [inline, virtual, inherited] |
| virtual bool claraty::Camera::set_format | ( | IMAGE_FORMAT | format, | |
| int | width_pixels = -1, |
|||
| int | height_pixels = -1 | |||
| ) | [inline, virtual, inherited] |
| virtual IMAGE_FORMAT claraty::Camera::get_format | ( | ) | const [inline, virtual, inherited] |
Definition at line 164 of file camera.h.
References claraty::Camera::MONO8.
Referenced by claraty::Camera::_verify_pixel_format().
00164 { return MONO8; }
| virtual bool claraty::Camera::set_subframe | ( | int | width_offset, | |
| int | height_offset, | |||
| int | width, | |||
| int | height | |||
| ) | [inline, virtual, inherited] |
| virtual int claraty::Camera::get_subframe_width_offset | ( | ) | const [inline, virtual, inherited] |
| virtual int claraty::Camera::get_subframe_height_offset | ( | ) | const [inline, virtual, inherited] |
| virtual int claraty::Camera::get_subframe_width | ( | ) | const [inline, virtual, inherited] |
Definition at line 187 of file camera.h.
References claraty::Camera::get_width().
00187 { return get_width(); };
Here is the call graph for this function:

| virtual int claraty::Camera::get_subframe_height | ( | ) | const [inline, virtual, inherited] |
Definition at line 188 of file camera.h.
References claraty::Camera::get_height().
00188 { return get_height(); };
Here is the call graph for this function:

| void claraty::Camera::acquire | ( | Camera_Image< Pixel_Type > & | image | ) | throw (std::exception) [inherited] |
Acquire a Camera_Image (template version).
Acquire a Camera_Image using the current feature settings from this logical camera. This routine may fail for a number of reasons. In particular, it fails if the Pixel_Type of the image parameter does not match that expected by the camera, as controlled by the set_format member function. On failure, an exception is thrown.
- Parameters:
-
[out] image Returns newly acquired Camera_Image. The image is resized to match the image size returned by the camera. The timestamp, and feature_map portions of the Camera_Image are updated by this routine. The camera_model portion of the Camera_Image returns the Camera_Model as set by the Camera constructor or set_camera_model_ptr().
Definition at line 281 of file camera.h.
References claraty::Camera::acquire().
00282 { 00283 // Camera must be a friend of Camera_Image; requires change in Camera_Image 00284 acquire(image, &image._timestamp, &image._feature_map); 00285 image._frame_num = 0; 00286 }
Here is the call graph for this function:

| bool claraty::Camera::io | ( | FDM_Map | map | ) | [virtual, inherited] |
Serializes a camera. Camera id, name and camera model that captures lens parameters are all option
- Parameters:
-
[in] map a map that holds the content of a serialized camera
Reimplemented from claraty::Device.
Definition at line 54 of file camera.cc.
References claraty::Device::io().
00055 { 00056 bool ok = Device::io(map); 00057 // Check to make sure that the the output is read back in will 00058 // operator >> construct the camera model. Check who owns it 00059 // Need to add an IO to the Camera Model object 00060 // ok &= map.field("_camera_model_ptr", _camera_model_ptr); 00061 return ok; 00062 }
Here is the call graph for this function:

| void claraty::Camera::_verify_pixel_format | ( | size_t | pixel_size | ) | [protected, inherited] |
Verify that the camera format matches the pixel size (either 8-bit or 16-bit/pixel (see IMAGE_FORMAT). Throw exception if mismatched
- Parameters:
-
[in] pixel_size number of bytes used for image pixels
Definition at line 105 of file camera.cc.
References AT_FUNCTION, claraty::Camera::get_format(), claraty::Camera::MONO16, claraty::Camera::MONO8, claraty::Camera::RGB16, claraty::Camera::RGB8, claraty::Camera::YUV411, claraty::Camera::YUV422, and claraty::Camera::YUV444.
Referenced by claraty::Camera_Group::_verify_pixel_format().
00106 { 00107 IMAGE_FORMAT format = get_format(); 00108 00109 switch(pixel_size) { 00110 00111 case 1: // 8 Bits 00112 if (format != MONO8 && format != YUV411 && 00113 format != YUV422 && format != YUV444 && 00114 format != RGB8) { 00115 std::ostringstream os; 00116 os << AT_FUNCTION << " camera: " << (*this) 00117 << " acquiring 16 bit-format images with camera set to 8 bit format" 00118 << endl; 00119 throw (os.str()); 00120 } 00121 break; 00122 00123 case 2: // 16 bits 00124 if (format != MONO16 && format != RGB16) { 00125 std::ostringstream os; 00126 os << AT_FUNCTION << " camera: " << (*this) 00127 << " acquiring 8 bit-format images with camera set to 16 bit format" 00128 << endl; 00129 throw (os.str()); 00130 } 00131 break; 00132 } 00133 }
Here is the call graph for this function:

| void claraty::Camera::_verify_resize_image | ( | Image< Pixel_Type > & | image | ) | [protected, inherited] |
Verify that the image size matches the camera frame size. If the image size does not match the camera frame size, this function will resize the image to the proper camera frame size.
- Parameters:
-
[in] image reference to an image object to be resized
Definition at line 298 of file camera.h.
References claraty::Camera::get_height(), claraty::Image< T >::get_height(), claraty::Camera::get_width(), claraty::Image< T >::get_width(), and claraty::N_2D_Array< T >::resize().
Referenced by claraty::Camera_Group::_verify_resize_images().
00299 { 00300 if ((image.get_width () != get_width()) && 00301 (image.get_height() != get_height())) 00302 image.resize(get_height(), get_width()); 00303 }
Here is the call graph for this function:

| bool claraty::Device::on | ( | ) | [inherited] |
Turn on the device.
- Returns:
- Returns true on success, false on failure.
Definition at line 61 of file device.cc.
References claraty::Device::_power_switch, and claraty::Power_Switch::set().
00062 { 00063 if (_power_switch == NULL) 00064 return true; 00065 else 00066 return _power_switch->set(true); 00067 }
Here is the call graph for this function:

| bool claraty::Device::off | ( | ) | [inherited] |
Turn off a device
- Returns:
- Returns true on success, false on failure.
Definition at line 75 of file device.cc.
References claraty::Device::_power_switch, and claraty::Power_Switch::set().
00076 { 00077 if (_power_switch == NULL) 00078 return false; 00079 else 00080 return _power_switch->set(false); 00081 }
Here is the call graph for this function:

| bool claraty::Device::is_on | ( | ) | [inherited] |
Check if a device is turned on.
- Returns:
- Returns true if this device is on, false if this device is off.
Definition at line 89 of file device.cc.
References claraty::Device::_power_switch, and claraty::Power_Switch::get().
00090 { 00091 if (_power_switch == NULL) 00092 return true; 00093 else 00094 return _power_switch->get(); 00095 }
Here is the call graph for this function:

| void claraty::Device::set_power_switch | ( | Power_Switch & | new_sw | ) | [inherited] |
Initialize the power switch functor. This should typically only be called at initialization time to bind a hardware switch, or other switching method, to this device.
- Parameters:
-
[in] new_sw power switch function object
Definition at line 106 of file device.cc.
References claraty::Device::_power_switch.
00107 { 00108 _power_switch = &new_sw; 00109 }
| std::string claraty::Device::get_name | ( | ) | const [inherited] |
Gets the name of the device
- Returns:
- Returns string containing name of this device.
Definition at line 117 of file device.cc.
References claraty::Device::_name.
Referenced by claraty::Device::display_xml().
00118 { 00119 return _name; 00120 };
| std::ostream & claraty::Device::display_xml | ( | const char * | pmsg, | |
| std::ostream & | os = std::cout | |||
| ) | const [inherited] |
Output the contents of device in an XML format
- Parameters:
-
[in] pmsg a text message to display before the output [in] os output stream with cout as a default
- Returns:
- the formatted output stream
Definition at line 148 of file device.cc.
References claraty::XML_Out::get_indentation_space(), and claraty::Device::get_name().
Referenced by claraty::operator<<().
00149 { 00150 // Set up the spacing for the indentation of the fields in the file 00151 std::string spacing = ""; 00152 spacing.append(XML_Out::get_indentation_space(), ' '); 00153 os << spacing << "<Device "; 00154 os << "name = \"" << get_name() << "\" "; 00155 os << " >"; 00156 return os; 00157 }
Here is the call graph for this function:

Member Data Documentation
const double claraty::Camera::DONT_CARE = -DOUBLE_EPSILON [static, inherited] |
Camera_Model* claraty::Camera::_camera_model_ptr [protected, inherited] |
Definition at line 254 of file camera.h.
Referenced by claraty::Camera::get_camera_model_ptr(), and claraty::Camera::set_camera_model_ptr().
std::string claraty::Device::_name [protected, inherited] |
name of this device
Definition at line 72 of file device.h.
Referenced by claraty::Device::get_name(), and claraty::Device::io().
Power_Switch* claraty::Device::_power_switch [protected, inherited] |
switch for turning device ON and OFF
Definition at line 73 of file device.h.
Referenced by claraty::Device::io(), claraty::Device::is_on(), claraty::Device::off(), claraty::Device::on(), and claraty::Device::set_power_switch().
The documentation for this class was generated from the following files: