本文整理汇总了C++中image::create方法的典型用法代码示例。如果您正苦于以下问题:C++ image::create方法的具体用法?C++ image::create怎么用?C++ image::create使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类image
的用法示例。
在下文中一共展示了image::create方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: paint
void stateBaseWave::paint()
{
trackDocument * doc = trackDocument::get();
static image viewImage;//画面表示用画像
viewImage.topdown = false;
viewImage.create( doc->baseWave.w, doc->baseWave.h );
pixel p( 0, 0, 0, 255 );
for ( int x = 0; x < viewImage.width; ++x ) {
int maxValue = doc->maxValues[x];
for ( int y = 0; y < viewImage.height; ++y ) {
p.r = p.g = p.b = static_cast<unsigned char>( clamp<int>( 0, double( doc->baseWave( x, y ) ) / maxValue * 255, 255 ) );
viewImage.setInternal( x, y, p );
}
}
array<int>::iterator it( doc->wave );
pixel c( 0, 255, 255, 255 );
pixel baseColor( 255, 0, 255, 255 );
for ( int x = 0; x < viewImage.width && it; ++x, ++it ) {
int y = doc->waveBias + it();
if ( x == doc->baseIndex ) {
viewImage.set( x, y, blend( viewImage.get( x, y ), baseColor ) );
} else {
viewImage.set( x, y, blend( viewImage.get( x, y ), c ) );
}
}
stateDocument::paint( viewImage );
}
示例3: main
int main ( int argc, char **argv )
{
int i, j, n, pid, t;
double pix;
double ir, ic;
int req, task, value;
char task_name[16];
log_start();
if ( argc < 2 ) {
fprintf(stderr,"Usage: %s param_file\n", argv[0]);
exit(1);
}
pe.mq = msgget ( getpid(), 0777|IPC_CREAT );
set_defaults();
p.read_file(argv[1]);
GDALAllRegister();
east1 = p.dvalue("easting_left");
east2 = p.dvalue("easting_right");
north1 = p.dvalue("northing_bottom");
north2 = p.dvalue("northing_top");
wid = p.dvalue("output_cell_size");
pix = p.dvalue("input_cell_size");
ir = p.dvalue("input_rows");
ic = p.dvalue("input_columns");
input_rows = (int)ir;
input_cols = (int)ic;
max_dist = 1.2 * pix * sqrt(ir*ir+ic*ic) / wid;
max_dist_2 = max_dist/2;
max_dist = max_dist * max_dist;
readers = p.ivalue("readers");
mappers = p.ivalue("mappers");
writers = p.ivalue("writers");
rows = int((north2 - north1) / wid);
cols = int((east2 - east1) / wid);
cindex = new int[cols];
dist.create(rows,cols);
img.create(rows,cols);
srand(time(NULL));
read_image_file(img);
fill ( img, dist, 0, rows );
//spread_dist ( img, dist );
//if ( p.value("dist_file") != "" ) output_dist_geotiff ( dist, v );
//if ( p.value("blob_file") != "" ) output_pcolor_geotiff ( img, dist, v );
sort ( img_indices, img_indices+img_ct, comp_row );
valid_img = new int[max_img_id];
for ( i = 0; i < img_ct; i++ ) {
j = img_indices[i];
valid_img[j] = 0;
if ( xy[j][0]+max_dist_2 >= 0 && xy[j][0]-max_dist_2 < rows ) {
pe.add_task ( "image", j );
}
}
read_dem_header(dem);
pe.launch ( dem_reader );
out.create_image(rows,cols);
for ( i = 0; i < out.rows; i += bs ) pe.add_task ( "mapper", i );
for ( i = 0; i < readers; i++ ) {
pe.launch ( reader );
}
for ( i = 0; i < mappers; i++ ) {
pe.launch ( mapper );
}
for ( i = 0; i < writers; i++ ) {
pe.launch ( writer );
}
while ( pe.children > 0 ) {
t = msgrcv ( pe.mq, &pe.msg, MSG_SIZE, 1, 0 );
if ( t < 0 ) perror("");
sscanf(pe.msg.s,"%d %d %s %d", &req, &pid, task_name, &value );
switch ( req ) {
case EXIT:
log("exit %d",pid);
pe.children--;
break;
case WAIT:
if ( pe.ready(task_name,value) ) {
sprintf(pe.msg.s,"1");
pe.msg.t = pid;
//printf("Sending %d task %d\n",pid,task);
log("wait %d %s %d",pid,task_name,value);
t = msgsnd ( pe.mq, &pe.msg, MSG_SIZE, 0 );
} else {
log("sleep %d %s %d",pid,task_name,value);
pe.enqueue ( task_name, value, pid );
//.........这里部分代码省略.........