int main(void) { // make and save IMAGE *img=makeimage(500,800); saveimage(img,"image3.ppm"); freeimage(img); // read and save img=readimage("image3.ppm"); image2hsv(img); saveimage(img,"image3c.ppm"); return 0; }
ImageViewer::ImageViewer(QWidget *parent) : QWidget(parent), ui(new Ui::ImageViewer) { ui->setupUi(this); connect(ui->actionSave_Image,SIGNAL(triggered()),this,SLOT(saveimage())); }
/*----------------------------------------------------------------------- | MAIN | -----------------------------------------------------------------------*/ int main () { FILE *ostream; ostream = fopen("orientation", "r"); errorf(ostream); FILE *estream; estream = fopen("export1.xyzi", "r"); errorf(estream); int i = linesoffilex(estream); points *cloud; cloud = malloc((sizeof(double) * i)* 3 + (sizeof(int) * i)); if (cloud == NULL) {error();} cloud = loadxyzi(estream, i); info orient; orient = orientation(ostream); values *real; real = malloc((sizeof(double) * i)* 3 + (sizeof(int) * i)* 4); if (real == NULL) {error();} real = project(cloud, i, orient); values *sort; sort = malloc((sizeof(double) * i)* 3 + (sizeof(int) * i)* 4); if (sort == NULL) {error();} sort = sorttod(real, i); int j = threshold(sort,i, orient); free(cloud); FILE *istream; istream = fopen("exportx", "r"); errorf(istream); values *project; project = malloc(sizeof(double) *i* 3 + sizeof(int) * 3* i); if (project == NULL) {error();} project = loadt(istream, j); saveimage(project, orient); printf("finished\n"); free(project); fclose(ostream); fclose(estream); fclose(istream); return 0; }
void screenshot(char *sname) { ImageData image(screen->w, screen->h, 3); glPixelStorei(GL_PACK_ALIGNMENT, 1); glReadPixels(0, 0, screen->w, screen->h, GL_RGB, GL_UNSIGNED_BYTE, image.data); string fname; if(sname && *sname) copystring(fname, sname); else formatstring(fname, "screenshots/%s", *filetimeformat ? gettime(filetimelocal ? currenttime : clocktime, filetimeformat) : (*mapname ? mapname : "screen")); saveimage(fname, image, imageformat, compresslevel, true); }
/** * Calculate the mandelbrot set * standard: flops=mandelbrotX(img,4096,-2.0,1.0,1.5,-1.5); */ int main(void) { double secs,flops; IMAGE *img=makeimage(1024,1024); start_timer(); flops=mandelbrot(img,4096,-1.2,-0.7,0.5,0.0); secs = stop_timer(); printf("%10.3e %10.3e %10.3e\n",secs,flops,1.0e-9*flops/secs); saveimage(img,"mandel.ppm"); return 0; }
static void showobject(int num, int gen) { fz_error error; fz_obj *obj; if (!xref) die(fz_throw("no file specified")); error = pdf_loadobject(&obj, xref, num, gen); if (error) die(error); if (isimage(obj)) saveimage(obj, num, gen); else if (isfontdesc(obj)) savefont(obj, num, gen); fz_dropobj(obj); }
static void showobject(int num) { fz_error error; fz_obj *obj; if (!xref) die(fz_error_make(ctx, "no file specified")); error = pdf_load_object(&obj, xref, num, 0); if (error) die(error); if (isimage(obj)) saveimage(num); else if (isfontdesc(obj)) savefont(obj, num); fz_drop_obj(ctx, obj); }
static void showobject(int num) { pdf_obj *obj; if (!doc) fz_throw(ctx, FZ_ERROR_GENERIC, "no file specified"); fz_try(ctx) { obj = pdf_load_object(ctx, doc, num); if (isimage(obj)) saveimage(num); else if (isfontdesc(obj)) savefont(obj, num); pdf_drop_obj(ctx, obj); } fz_catch(ctx) { fz_warn(ctx, "ignoring object %d", num); } }
/* write result file */ int writerezfile(PIX *pixs,char *source_fname,ANS *ans, BAR *bar, SID *sid){ int i; float mincert; char fname[1024]; char picfname[1024]; char *base=calloc(1024,sizeof(char)); // char *ending=calloc(25,sizeof(char)); char *ridx=rindex(source_fname,'.'); char *ansarray; base=strncpy(base, source_fname,ridx-source_fname); char *picname=rindex(base,'/'); if(picname==NULL) picname=base; mincert=100.0; for(i=0;i<SID_LENGTH;i++){ if(sid->certainty[i]<mincert){ mincert=sid->certainty[i]; } } if(bar->barcode==NULL) sprintf(fname,"%s/%s.err",output_dir,picname); else if(mincert<SID_MIN_CERTAINTY) sprintf(fname,"%s/%s.war",output_dir,picname); else sprintf(fname,"%s/%s.rez",output_dir,picname); sprintf(picfname,"%s/%s.png",output_dir,picname); FILE *fh=fopen(fname,"w"); fprintf(fh,"%s\n",bar->barcode+1); fprintf(fh,"%s\n",sid->sid); fprintf(fh,"%s\n",ans->ans_string); fprintf(fh,"%d\n",(int)(mincert*100)); fprintf(fh,"A\n"); /* fprintf(fh,"x=array("); for(i=0;i<ans->up->n-1;i++){ fprintf(fh,"%f,",ans->up->mark[i].x); } fprintf(fh,"%f);",ans->up->mark[i].x); fprintf(fh,"y=array("); for(i=0;i<ans->right->n-1;i++){ fprintf(fh,"%f,",ans->right->mark[i].y); } fprintf(fh,"%f);\n",ans->right->mark[i].y); */ ansarray=ans_array(ans); fprintf(fh,"%s\n",ansarray); free(ansarray); fclose(fh); //rescale image PIX *pixd=pixScale(pixs, (float)1280/pixGetWidth(pixs),(float)1280/pixGetWidth(pixs)); saveimage(pixd,picfname); pixDestroy(&pixd); sprintf(fname,"%s/%s.%s",processed_dir,picname,ridx+1); int retval=rename(source_fname, fname); if(retval<0){ dfprintf(stderr,"rename not successful!\n"); } free(base); return 0; }
void button_save(GtkWidget *widget, gpointer data) { saveimage(&img); }
//*********************************************************************************** int main (int argc, char ** argv) { int i; dev_name = VDEVICENAME; printf ("Opening device %s\n", dev_name); bok = 0; for (;;) { int index; int c; c = getopt_long (argc, argv, short_options, long_options, &index); printf("%d",c); if (-1 == c) break; switch (c) { case 0: /* getopt_long() flag */ break; case 'd': dev_name = optarg; break; case 'h': usage (stdout, argc, argv); exit (EXIT_SUCCESS); case 'm': io = IO_METHOD_MMAP; break; case 'r': io = IO_METHOD_READ; break; case 'u': io = IO_METHOD_USERPTR; break; case 'e': io = IO_METHOD_SETEXPOSURE; exposure = atoi(optarg); break; case 'g': io = IO_METHOD_SETGAIN; gain = atoi(optarg); break; default: usage (stderr, argc, argv); exit (EXIT_FAILURE); } } open_device (); init_device (); start_capturing (); mainloop (); stop_capturing (); uninit_device (); close_device (); if (bok) { saveimage(); } printf("\n"); exit (EXIT_SUCCESS); return 0; }