コード例 #1
0
void CDifodoDatasets::loadConfiguration(unsigned int &i_rows, unsigned int &i_cols,
                                        vector<CPose3D> &v_poses,
                                        const string &rawlogFileName,
                                        vector<unsigned int> &cameras_order,
                                        bool visualizeResults )
{	
    visualize_results = visualizeResults;

	fovh = M_PI*62.5/180.0;	//Larger FOV because depth is registered with color
	fovv = M_PI*48.5/180.0;


    rows = i_rows;
    cols = i_cols;

    cam_mode = 2;

	fast_pyramid = false;

    downsample = 1; // 1 - 640x480, 2 - 320x240, 4 - 160x120

    ctf_levels = 5;

    fast_pyramid = true;

    //				Load cameras' extrinsic calibrations
    //==================================================================

    cams_oder = cameras_order;

    for ( int c = 0; c < NC; c++ )
    {
        cam_pose[c] = v_poses[c];
        CMatrixDouble44 homoMatrix;
        cam_pose[c].getHomogeneousMatrix(homoMatrix);
        calib_mat[c] = (CMatrixFloat44)homoMatrix.inverse();
    }

	//						Open Rawlog File
	//==================================================================
    if (!dataset.loadFromRawLogFile(rawlogFileName))
		throw std::runtime_error("\nCouldn't open rawlog dataset file for input...");

	rawlog_count = 0;

	// Set external images directory:
    const string imgsPath = CRawlog::detectImagesDirectory(rawlogFileName);
	CImage::IMAGES_PATH_BASE = imgsPath;

	//			Resize matrices and adjust parameters
	//=========================================================
	width = 640/(cam_mode*downsample);
	height = 480/(cam_mode*downsample);
	repr_level = utils::round(log(float(width/cols))/log(2.f));

	//Resize pyramid
    const unsigned int pyr_levels = round(log(float(width/cols))/log(2.f)) + ctf_levels;

	for (unsigned int c=0; c<NC; c++)
	{
		for (unsigned int i = 0; i<pyr_levels; i++)
		{
			unsigned int s = pow(2.f,int(i));
			cols_i = width/s; rows_i = height/s;
			depth[c][i].resize(rows_i, cols_i);
			depth_inter[c][i].resize(rows_i, cols_i);
			depth_old[c][i].resize(rows_i, cols_i);
			depth[c][i].assign(0.0f);
			depth_old[c][i].assign(0.0f);
			xx[c][i].resize(rows_i, cols_i);
			xx_inter[c][i].resize(rows_i, cols_i);
			xx_old[c][i].resize(rows_i, cols_i);
			xx[c][i].assign(0.0f);
			xx_old[c][i].assign(0.0f);
			yy[c][i].resize(rows_i, cols_i);
			yy_inter[c][i].resize(rows_i, cols_i);
			yy_old[c][i].resize(rows_i, cols_i);
			yy[c][i].assign(0.0f);
			yy_old[c][i].assign(0.0f);
			zz_global[c][i].resize(rows_i, cols_i);
			xx_global[c][i].resize(rows_i, cols_i);
			yy_global[c][i].resize(rows_i, cols_i);

			if (cols_i <= cols)
			{
				depth_warped[c][i].resize(rows_i,cols_i);
				xx_warped[c][i].resize(rows_i,cols_i);
				yy_warped[c][i].resize(rows_i,cols_i);
			}
		}

		//Resize matrix that store the original depth image
		depth_wf[c].setSize(height,width);
	}

	//Resize the transformation matrices
	for (unsigned int l = 0; l<pyr_levels; l++)
		global_trans[l].resize(4,4);

	for (unsigned int c=0; c<NC; c++)	
		for (unsigned int l = 0; l<pyr_levels; l++)
			transformations[c][l].resize(4,4);
}