static void ewin_cb_export_clicked(GtkWidget *widget, gpointer data) { struct fp_img *scan = NULL; int finger = GPOINTER_TO_INT(data); int r; char path[2048]; sprintf(path,"captured_%d.pgm",finger); if (!fp_dev_supports_imaging(fpdev)) { fprintf(stderr, "this device does not have imaging capabilities.\n"); return; } r = fp_dev_img_capture(fpdev,0,&scan); if (r != 0) { fprintf(stderr,"Image Capture Failed: %d\n",r); fp_img_free(scan); return; } fp_img_standardize(scan); r = fp_img_save_to_file(scan,path); fp_img_free(scan); if (r != 0) { fprintf(stderr,"Image Save Failed: %d\n",r); } return; }
struct fp_img* get_image(struct fp_dev* dev){ if(!fp_dev_supports_imaging(dev)){ printf("Okuyucuda imaging destegi yok ... :(\n"); exit(1); //failure } struct fp_img* image = NULL; if(fp_dev_img_capture(dev, 0, &image)){ //0 on success printf("Resim alinamadi.\n"); exit(1); //failure } return image; }
/**Helper: Read an image into a variable*/ struct fp_img* image_get(){ //imaging supported? if(!fp_dev_supports_imaging(device)){ pyfmsg(ERR_LFP_NOIMAGING, 1); } //capture image struct fp_img* image = NULL; if (fp_dev_img_capture(device, 0, &image)){ pyfmsg(ERR_LFP_IMAGINGFAIL, 1); } return image; }