当前位置: 首页>>代码示例>>C++>>正文


C++ Package::at方法代码示例

本文整理汇总了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;
}
开发者ID:ttnguyenUBP,项目名称:T3DV_backup,代码行数:68,代码来源:projection.cpp

示例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;
}
开发者ID:ttnguyenUBP,项目名称:T3DV_backup,代码行数:64,代码来源:projection.cpp


注:本文中的Package::at方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。