camera_group.ipp
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 namespace claraty {
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052 template <class Pixel_Type>
00053 int Camera_Group::
00054 _acquire(std::vector< Image<Pixel_Type> * > & image_vec,
00055 std::vector< Time > * timestamp_vec,
00056 std::vector< Feature_Map * > * feature_map_vec)
00057 throw (std::exception)
00058 {
00059 if (image_vec.size() != get_size() ||
00060 timestamp_vec->size() != get_size() ||
00061 feature_map_vec->size() != get_size()) {
00062 std::ostringstream os;
00063 os << AT_FUNCTION << "camera group acquire failed: invalid argument"
00064 << "image vector size does not match group size" << std::endl;
00065 throw std::invalid_argument(os.str());
00066 }
00067
00068
00069 _verify_pixel_format(sizeof(Pixel_Type));
00070
00071
00072 _verify_resize_images(image_vec);
00073
00074
00075 for (unsigned int i = 0; i < image_vec.size(); ++i) {
00076 Camera & cam = get_camera(i);
00077 if (timestamp_vec && feature_map_vec)
00078 cam.acquire(*image_vec[i], &(*timestamp_vec)[i], (*feature_map_vec)[i]);
00079 else if (timestamp_vec)
00080 cam.acquire(*image_vec[i], &(*timestamp_vec)[i]);
00081 else
00082 cam.acquire(*image_vec[i]);
00083 }
00084 return image_vec.size();
00085 }
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097 template <class Pixel_Type>
00098 int Camera_Group::
00099 acquire(std::vector< Camera_Image<Pixel_Type> * > & cam_img_ptr_vec)
00100 {
00101 std::vector< Image< Pixel_Type > * > img_ptr_vec(cam_img_ptr_vec.size());
00102 std::vector< Time > time_ptr_vec(cam_img_ptr_vec.size());
00103 std::vector< Feature_Map * > feature_map_ptr_vec(cam_img_ptr_vec.size());
00104 for (unsigned int i = 0; i < cam_img_ptr_vec.size(); ++i) {
00105 img_ptr_vec[i] = cam_img_ptr_vec[i];
00106 time_ptr_vec[i] = &cam_img_ptr_vec[i]->_timestamp;
00107 feature_map_ptr_vec[i] = &cam_img_ptr_vec[i]->_feature_map;
00108 }
00109 return _acquire(img_ptr_vec, time_ptr_vec, feature_map_ptr_vec);
00110 }
00111
00112
00113
00114
00115
00116 template <class Pixel_Type>
00117 int Camera_Group::
00118 acquire(std::vector< Camera_Image<Pixel_Type> > & cam_img_vec)
00119 {
00120 if (cam_img_vec.size() != get_size()) cam_img_vec.resize(get_size());
00121 std::vector< Image< Pixel_Type > * > img_ptr_vec(get_size());
00122 std::vector< Time * > time_ptr_vec(get_size());
00123 std::vector< Feature_Map * > feature_map_ptr_vec(get_size());
00124 for (unsigned int i = 0; i < get_size(); ++i) {
00125 img_ptr_vec[i] = &cam_img_vec[i];
00126 time_ptr_vec[i] = &cam_img_vec[i]._timestamp;
00127 feature_map_ptr_vec[i] = &cam_img_vec[i]._feature_map;
00128 }
00129 return _acquire(img_ptr_vec, time_ptr_vec, feature_map_ptr_vec);
00130 }
00131
00132
00133
00134 }