Data Structure
[Vision Package]
Collaboration diagram for Data Structure:
|
Classes | |
| class | claraty::Camera_Model |
| class | claraty::A_Camera_Model |
| class | claraty::Image< T > |
| class | claraty::RGB_Color< T > |
| class | claraty::Tsai_Camera_Model |
Detailed Description
#Image related classes. An Image is a two dimensional array that supports math operations and subpixel access. It inherits from Matrix for the data representation and math operations (Matrix actually inherits from Array_2D for its data representation) and adds the concept of sampling (knowledge that pixels represent an intensity). Images are represented as a one dimensional array (continous memory) with an index pointer to each row, allowing pixels to be accessed with no math operations. Images also support copy and no-copy subimages: a subimage (which is an Image) can be copied out of an Image or aliased to a portion of an Image.
Images can be created with an initial size:
Image<unsigned char> my_image(640, 480); // create an image
my_image(45,76) = 23; // set a value
Or as an aliased subimage of an existing image:
Image<unsigned char> my_subarray(my_image, 0, 0, 12, 24); // create a subimage
my_subimage.displace_subarray(2, 4); // move the subimage
Or with some data (the data can be any iteratable data type):
short data[] = {1, 2, 3, 4, 5, 6, 7, 8};
Image<short> my_init_image2(2, 4, data); // create an intialized image
Or with a single default value that is used to fill the Image:
Image<double> my_init_image(640, 480, 1.0); // another way to initialize an image
You can also access an interpolated pixel in an Image:
my_init_image.set_interpolation_type(Image<double>::BILINEAR);
double value = my_init_image.pixel(45.7, 76.223); // access the image with interpolation
A Camera_Image is an Image with a frame number, time stamp, and Camera_Model (which reflect where and when the Image was taken and the properties of the Camera that took the Image).
A Camera_Image can be created in the same ways as an Image, but also requires a Camera_Model to be provided. For example:
Framestore my_fs("World"); // we must create a framestore first
Frame_l my_camera_frame = my_fs.add_frame("my camera image"); // and give it a camera frame
my_camera_frame.set_location(1, 2, 3, 0.1, 0.2, 0.3); // and set the location of the camera
Camera_Model_Matrix my_camera_model(my_camera_frame); // now we can create a model with a specific location/orientation
Camera_Image<char> my_camera_image(my_camera_model); // and finally create an image that has the model
Generally a Camera will generate a Camera_Image with the proper frame.