本文整理汇总了C++中Package::at方法的典型用法代码示例。如果您正苦于以下问题:C++ Package::at方法的具体用法?C++ Package::at怎么用?C++ Package::at使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Package
的用法示例。
在下文中一共展示了Package::at方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: createPanoImage_Diff_Abs_
void Projection::createPanoImage_Diff_Abs_() {
unsigned int numCam = input_package_->size();
unsigned int wImage = input_package_->at(0).width();
#pragma omp parallel for
for (unsigned int y = 0; y < height_; ++y) {
for (unsigned int x = 0; x < width_; ++x) {
bool check_overlap = false;
for (unsigned int i = 0; i < numCam; ++i)
check_overlap = (check_overlap || (*mask_package_)[i].data()[x + y * width_]);
Coordinate_ coordinate = *(mask_cylinder_ + x + y * width_);
int cam_index = coordinate.cam_index;
if ((cam_index >= 0) && (!check_overlap)) {
unsigned int xD = (unsigned int)coordinate.point.u(), yD = (unsigned int)coordinate.point.v(); // Read integer point
(*pano_image_).data()[3*(x + y * width_)] = (*input_package_)[cam_index].data()[3*(xD + yD * wImage)];
(*pano_image_).data()[3*(x + y * width_) + 1] = (*input_package_)[cam_index].data()[3*(xD + yD * wImage) + 1];
(*pano_image_).data()[3*(x + y * width_) + 2] = (*input_package_)[cam_index].data()[3*(xD + yD * wImage) + 2];
}
}
}
Package<Image>* tmp;
tmp = new Package<Image>(input_package_->size(),width_, height_, Image::RGB, true);
for (unsigned int camera = 0; camera < numCam; ++camera) {
#pragma omp parallel for
for (unsigned int y = 0; y < height_; ++y) {
for (unsigned int x = 0; x < width_; ++x) {
if ((*mask_package_)[camera].data()[x + y * width_] || (*mask_package_)[(camera-1+numCam)%numCam].data()[x + y * width_]) {
RealPoint2D pos = maps_[camera][x + y * width_];
unsigned int xD = (unsigned int)pos.u(), yD = (unsigned int)pos.v(); // Read integer point
(*tmp)[camera].data()[3*(x + y * width_)] = (*input_package_)[camera].data()[3*(xD + yD * wImage)];
(*tmp)[camera].data()[3*(x + y * width_) + 1] = (*input_package_)[camera].data()[3*(xD + yD * wImage) + 1];
(*tmp)[camera].data()[3*(x + y * width_) + 2] = (*input_package_)[camera].data()[3*(xD + yD * wImage) + 2];
}
}
}
}
const float coff_r = 0.299, coff_g = 0.587, coff_b = 0.114; // CCIR 601
// const float coff_r = 0.2126, coff_g = 0.7152, coff_b = 0.0722; // ITU-R
for (unsigned int camera = 0; camera < numCam; ++camera) {
#pragma omp parallel for
for (unsigned int y = 0; y < height_; ++y) {
for (unsigned int x = 0; x < width_; ++x) {
if ((*mask_package_)[camera].data()[x + y * width_]) {
unsigned int camera1 = (camera + 1) % numCam;
float c1 = coff_r * (float)((tmp->at(camera)).data()[3*(x + y * (tmp->at(camera)).width())])
+ coff_g * (float)((tmp->at(camera)).data()[3*(x + y * (tmp->at(camera)).width()) + 1])
+ coff_b * (float)((tmp->at(camera)).data()[3*(x + y * (tmp->at(camera)).width()) + 2]);
float c2 = coff_r * (float)((tmp->at(camera1)).data()[3*(x + y * (tmp->at(camera1)).width())])
+ coff_g * (float)((tmp->at(camera1)).data()[3*(x + y * (tmp->at(camera1)).width()) + 1])
+ coff_b * (float)((tmp->at(camera1)).data()[3*(x + y * (tmp->at(camera1)).width()) + 2]);
float dssim = fabs(c1 - c2);
//cout << dssim << " ";
(*pano_image_).data()[3*(x + y * width_)] = (unsigned int) (dssim);
(*pano_image_).data()[3*(x + y * width_) + 1] = (unsigned int) (dssim);
(*pano_image_).data()[3*(x + y * width_) + 2] = (unsigned int) (dssim);
}
}
}
}
delete tmp;
}
示例2: createPanoImage_Diff_Structure_
void Projection::createPanoImage_Diff_Structure_() {
unsigned int numCam = input_package_->size();
unsigned int wImage = input_package_->at(0).width();
#pragma omp parallel for
for (unsigned int y = 0; y < height_; ++y) {
for (unsigned int x = 0; x < width_; ++x) {
bool check_overlap = false;
for (unsigned int i = 0; i < numCam; ++i)
check_overlap = (check_overlap || (*mask_package_)[i].data()[x + y * width_]);
Coordinate_ coordinate = *(mask_cylinder_ + x + y * width_);
int cam_index = coordinate.cam_index;
if ((cam_index >= 0) && (!check_overlap)) {
unsigned int xD = (unsigned int)coordinate.point.u(), yD = (unsigned int)coordinate.point.v(); // Read integer point
(*pano_image_).data()[3*(x + y * width_)] = (*input_package_)[cam_index].data()[3*(xD + yD * wImage)];
(*pano_image_).data()[3*(x + y * width_) + 1] = (*input_package_)[cam_index].data()[3*(xD + yD * wImage) + 1];
(*pano_image_).data()[3*(x + y * width_) + 2] = (*input_package_)[cam_index].data()[3*(xD + yD * wImage) + 2];
}
}
}
Package<Image>* tmp;
tmp = new Package<Image>(input_package_->size(),width_, height_, Image::RGB, true);
for (unsigned int camera = 0; camera < numCam; ++camera) {
#pragma omp parallel for
for (unsigned int y = 0; y < height_; ++y) {
for (unsigned int x = 0; x < width_; ++x) {
if ((*mask_package_)[camera].data()[x + y * width_] || (*mask_package_)[(camera-1+numCam)%numCam].data()[x + y * width_]) {
RealPoint2D pos = maps_[camera][x + y * width_];
unsigned int xD = (unsigned int)pos.u(), yD = (unsigned int)pos.v(); // Read integer point
(*tmp)[camera].data()[3*(x + y * width_)] = (*input_package_)[camera].data()[3*(xD + yD * wImage)];
(*tmp)[camera].data()[3*(x + y * width_) + 1] = (*input_package_)[camera].data()[3*(xD + yD * wImage) + 1];
(*tmp)[camera].data()[3*(x + y * width_) + 2] = (*input_package_)[camera].data()[3*(xD + yD * wImage) + 2];
}
}
}
}
// Image img = tmp->at(0);
// img.save("test.png", Image::PNG);
// img = tmp->at(1);
// img.save("test1.png", Image::PNG);
for (unsigned int camera = 0; camera < numCam; ++camera) {
#pragma omp parallel for
for (unsigned int y = 0; y < height_; ++y) {
for (unsigned int x = 0; x < width_; ++x) {
if ((*mask_package_)[camera].data()[x + y * width_]) {
RealPoint2D pos(x,y);
unsigned int camera1 = (camera + 1) % numCam;
Window_image win1(tmp->at(camera), pos, mask_package_->at(camera), N_size_, N_size_); //3, 3
Window_image win2(tmp->at(camera1), pos, mask_package_->at(camera), N_size_, N_size_); //3, 3
float dssim = win1.DSSIM(win2);
//cout << dssim << " ";
(*pano_image_).data()[3*(x + y * width_)] = (unsigned int) (dssim * 255.0);
(*pano_image_).data()[3*(x + y * width_) + 1] = (unsigned int) (dssim * 255.0);
(*pano_image_).data()[3*(x + y * width_) + 2] = (unsigned int) (dssim * 255.0);
}
}
}
}
delete tmp;
}