本文整理汇总了C++中params::value方法的典型用法代码示例。如果您正苦于以下问题:C++ params::value方法的具体用法?C++ params::value怎么用?C++ params::value使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类params
的用法示例。
在下文中一共展示了params::value方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: read_dem_header
void read_dem_header ( image<short> & dem )
{
char file[1000];
GDALDataset *df;
GDALRasterBand *bd;
double trans[6];
int rows, cols;
strcpy ( file, p.value("dem_file").c_str());
if ( strlen(file) == 0 ) {
fprintf(stderr,"Need to specify a dem file\n");
exit(1);
}
df = (GDALDataset *) GDALOpen( file, GA_ReadOnly );
if( df == NULL ) {
fprintf(stderr,"Could not open dem file: %s\n", file );
exit(1);
}
rows = df->GetRasterYSize();
cols = df->GetRasterXSize();
dem.create(rows,cols);
if( df->GetGeoTransform( trans ) == CE_None ) {
dem_east = trans[0];
dem_north = trans[3];
dem_wid = trans[1];
} else {
fprintf(stderr,"Dem file: %s has no geographic metadata\n", file );
exit(1);
}
delete df;
}
示例2: output_dist_geotiff
void output_dist_geotiff ( image<float> & dist, image<unsigned char> & v )
{
int r, c;
int val;
OGRSpatialReference ref;
GDALDataset *df;
char *wkt = NULL;
GDALRasterBand *bd;
double trans[6];
GDALDriver *gt;
char **options = NULL;
int ov[] = { 2, 4, 8, 16, 32 };
int nov;
int n;
char file[1000];
options = CSLSetNameValue ( options, "TILED", "NO" );
options = CSLSetNameValue ( options, "COMPRESS", "LZW" );
gt = GetGDALDriverManager()->GetDriverByName("GTiff");
if ( !gt ) {
fprintf(stderr,"Could not get GTiff driver\n");
exit(1);
}
strcpy ( file, p.value("dist_file").c_str() );
df = gt->Create( file, dist.cols, dist.rows, 1, GDT_Byte, options );
if( df == NULL ) {
fprintf(stderr,"Could not create %s\n", file );
exit(1);
}
trans[0] = p.dvalue("easting_left");
trans[1] = p.dvalue("output_cell_size");
trans[2] = 0.0;
trans[3] = p.dvalue("northing_top");
trans[4] = 0.0;
trans[5] = -p.dvalue("output_cell_size");
df->SetGeoTransform ( trans );
ref.SetUTM ( p.ivalue("utm_zone") );
ref.SetWellKnownGeogCS ( "NAD27" );
ref.exportToWkt ( &wkt );
df->SetProjection(wkt);
CPLFree ( wkt );
for ( r=0; r < dist.rows; r++ ) {
for ( c=0; c < dist.cols; c++ ) {
val = int(sqrt(dist[r][c])+0.5);
if ( val > 255 ) val = 255;
v[r][c] = val;
}
}
bd = df->GetRasterBand(1);
bd->RasterIO( GF_Write, 0, 0, v.cols, v.rows, v.data,
v.cols, v.rows, GDT_Byte, 0, 0 );
delete df;
df = (GDALDataset *)GDALOpen ( file, GA_Update );
if( df == NULL ) {
fprintf(stderr,"Could not open for update %s\n", file );
exit(1);
}
nov = p.ivalue("overviews");
if ( nov > 5 ) nov = 5;
if ( nov > 0 ) {
n = 1;
df->BuildOverviews("NEAREST", nov, ov, 1, &n, NULL, NULL );
}
}
示例3: output_geotiff
void output_geotiff ( rgb_image & out )
{
int i, r, c;
int val;
char s[2];
OGRSpatialReference ref;
GDALDataset *df;
char *wkt = NULL;
GDALRasterBand *bd;
double trans[6];
GDALDriver *gt;
char **options = NULL;
int ov[] = { 2, 4, 8, 16, 32 };
int nov;
int n;
int bands[] = { 1, 2, 3 };
char file[1000];
int block, ir, rows;
options = CSLSetNameValue ( options, "TILED", "NO" );
options = CSLSetNameValue ( options, "BLOCKXSIZE", "256" );
options = CSLSetNameValue ( options, "BLOCKYSIZE", "256" );
options = CSLSetNameValue ( options, "COMPRESS", "LZW" );
gt = GetGDALDriverManager()->GetDriverByName("GTiff");
if ( !gt ) {
fprintf(stderr,"Could not get GTiff driver\n");
exit(1);
}
strcpy ( file, p.value("output_file").c_str() );
df = gt->Create( file, out.cols, out.rows, 3, GDT_Byte, options );
if( df == NULL ) {
fprintf(stderr,"Could not create %s\n", file );
exit(1);
}
trans[0] = p.dvalue("easting_left");
trans[1] = p.dvalue("output_cell_size");
trans[2] = 0.0;
trans[3] = p.dvalue("northing_top");
trans[4] = 0.0;
trans[5] = -p.dvalue("output_cell_size");
df->SetGeoTransform ( trans );
ref.SetUTM ( p.ivalue("utm_zone") );
ref.SetWellKnownGeogCS ( "NAD27" );
ref.exportToWkt ( &wkt );
df->SetProjection(wkt);
CPLFree ( wkt );
for ( ir = 0; ir < out.rows; ir += bs ) {
rows = out.rows - ir;
if ( rows > bs ) rows = bs;
//printf("Writer waiting for %d\n",ir );
pe.wait_for("data",ir);
for ( i = 0; i < 3; i++ ) {
bd = df->GetRasterBand(i+1);
bd->RasterIO( GF_Write, 0, ir, out.cols, rows,
out.img[i].data+ir*out.cols,
out.cols, rows, GDT_Byte, 0, 0 );
}
}
delete df;
df = (GDALDataset *)GDALOpen ( file, GA_Update );
if( df == NULL ) {
fprintf(stderr,"Could not open for update %s\n", file );
exit(1);
}
nov = p.ivalue("overviews");
if ( nov > 5 ) nov = 5;
if ( nov > 0 ) {
df->BuildOverviews("NEAREST", nov, ov, 3, bands, NULL, NULL );
}
}
示例4: read_image_file
void read_image_file(image<short> & img)
{
double camera_roll, camera_pitch, camera_yaw;
FILE *fp;
rgb_image rgb, *q;
double east, north, alt;
img_map::iterator i;
vec3 utm(0,0,0), x(1,0,0), y(0,1,0), z(0,0,1);
mat4 trans, roll, pitch, yaw;
camera_roll = p.dvalue("camera_roll");
camera_pitch = p.dvalue("camera_pitch");
camera_yaw = p.dvalue("camera_yaw");
fp = fopen ( p.value("images_file").c_str(), "r" );
if ( !fp ) {
fprintf(stderr,"Could not open images file: %s\n",
p.value("images_file").c_str() );
exit(1);
}
xy[0][0] = -2*img.rows;
xy[0][1] = -2*img.cols;
while ( rgb.read_params(fp) ) {
if ( rgb.id > max_img_id ) max_img_id = rgb.id;
imgs[rgb.id] = rgb;
}
fclose(fp);
img_indices = new int[max_img_id+1];
sea_level = p.dvalue("sea_level");
i = imgs.begin();
while ( i != imgs.end() ) {
q = &i->second;
q->create_image(input_rows,input_cols);
//printf("%s\n", q->pathname.c_str());
//printf("%d %10.2f %10.2f %7.2f %7.2f %7.2f %7.2f\n",p->id,
//p->east, p->north, p->alt,
//p->omega, p->phi, p->kappa );
img_indices[img_ct] = q->id;
img_ct++;
utm[0]=q->east;
utm[1]=q->north;
trans = translation3D(utm);
pitch = rotation3D ( x, q->omega);
roll = rotation3D ( y, q->phi);
yaw = rotation3D ( z, q->kappa);
q->M = pitch;
q->M = q->M * roll;
q->M = q->M * yaw;
q->zrot = -1.0 * z;
q->zrot = q->M * q->zrot;
q->M = trans;
q->M = q->M * pitch;
q->M = q->M * roll;
q->M = q->M * yaw;
q->MI = q->M.inverse();
q->unit_depth = p.dvalue("focal_length")*1000.0/p.dvalue("pixel_size");
q->cam = utm;
q->cam[2] = 0;
i++;
}
}