当前位置: 首页>>代码示例>>C++>>正文


C++ LibRaw::dcraw_ppm_tiff_writer方法代码示例

本文整理汇总了C++中LibRaw::dcraw_ppm_tiff_writer方法的典型用法代码示例。如果您正苦于以下问题:C++ LibRaw::dcraw_ppm_tiff_writer方法的具体用法?C++ LibRaw::dcraw_ppm_tiff_writer怎么用?C++ LibRaw::dcraw_ppm_tiff_writer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在LibRaw的用法示例。


在下文中一共展示了LibRaw::dcraw_ppm_tiff_writer方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: process_once

int process_once(LibRaw& RawProcessor, int half_mode, int camera_wb, int auto_wb, int suffix, int user_flip,char *fname)
{
    char outfn[1024];
    RawProcessor.imgdata.params.half_size = half_mode;
    RawProcessor.imgdata.params.use_camera_wb = camera_wb;
    RawProcessor.imgdata.params.use_auto_wb = auto_wb;
    RawProcessor.imgdata.params.user_flip = user_flip;

    int ret = RawProcessor.dcraw_process();
                
    if(LIBRAW_SUCCESS !=ret)
        {
            fprintf(stderr,"Cannot do postpocessing on %s: %s\n",
                    fname,libraw_strerror(ret));
            return ret; 
        }
    snprintf(outfn,sizeof(outfn),"%s.%d.%s", fname, suffix, (RawProcessor.imgdata.idata.colors>1?"ppm":"pgm"));

    printf("Writing file %s\n",outfn);

    if( LIBRAW_SUCCESS != (ret = RawProcessor.dcraw_ppm_tiff_writer(outfn)))
        fprintf(stderr,"Cannot write %s: %s\n",outfn,libraw_strerror(ret));
    return ret;
}
开发者ID:ChunHungLiu,项目名称:PhotoFlow,代码行数:24,代码来源:multirender_test.cpp

示例2: main


//.........这里部分代码省略.........
                "\t-T - output TIFF files instead of .pgm/ppm\n"
                "\t-e - extract thumbnails (same as dcraw -e in separate run)\n",LibRaw::version(),
                LibRaw::cameraCount(),
                av[0]);
            return 0;
        }
    
    putenv ((char*)"TZ=UTC"); // dcraw compatibility, affects TIFF datestamp field

#define P1 RawProcessor.imgdata.idata
#define S RawProcessor.imgdata.sizes
#define C RawProcessor.imgdata.color
#define T RawProcessor.imgdata.thumbnail
#define P2 RawProcessor.imgdata.other
#define OUT RawProcessor.imgdata.params


    for (i=1;i<ac;i++)
        {
            if(av[i][0]=='-')
                {
                    if(av[i][1]=='T' && av[i][2]==0)
                        OUT.output_tiff=1;
                    if(av[i][1]=='v' && av[i][2]==0)
                        verbose++;
                    if(av[i][1]=='e' && av[i][2]==0)
                        output_thumbs++;
                    if(av[i][1]=='D' && av[i][2]==0)
                        OUT.document_mode=2;
                    if(av[i][1]=='4' && av[i][2]==0)
                        OUT.output_bps=16;
                    if(av[i][1]=='C' && av[i][2]==0)
                        RawProcessor.set_progress_handler(my_progress_callback,NULL);
                    continue;
                }

            if(verbose) printf("Processing file %s\n",av[i]);

            if( (ret = RawProcessor.open_file(av[i])) != LIBRAW_SUCCESS)
                {
                    fprintf(stderr,"Cannot open_file %s: %s\n",av[i],libraw_strerror(ret));
                    continue; // no recycle b/c open file will recycle itself
                }
            
            if( (ret = RawProcessor.unpack() ) != LIBRAW_SUCCESS)
                {
                    fprintf(stderr,"Cannot unpack %s: %s\n",av[i],libraw_strerror(ret));
                    continue;
                }

            // thumbnail unpacking and output in the middle of main
            // image processing - for test purposes!
            if(output_thumbs)
                {
                    if( (ret = RawProcessor.unpack_thumb() ) != LIBRAW_SUCCESS)
                        {
                            fprintf(stderr,"Cannot unpack_thumb %s: %s\n",av[i],libraw_strerror(ret));
                            if(LIBRAW_FATAL_ERROR(ret))
                                continue; // skip to next file
                        }
                    else
                        {
                            snprintf(thumbfn,sizeof(thumbfn),"%s.%s",
                                     av[i],T.tformat == LIBRAW_THUMBNAIL_JPEG ? "thumb.jpg" : "thumb.ppm");

                            if(verbose) printf("Writing thumbnail file %s\n",thumbfn);
                            if( LIBRAW_SUCCESS != (ret = RawProcessor.dcraw_thumb_writer(thumbfn)))
                                {
                                    fprintf(stderr,"Cannot write %s: %s\n",thumbfn,libraw_strerror(ret));
                                    if(LIBRAW_FATAL_ERROR(ret))
                                        continue; 
                                }
                        }
                }
            
            if(OUT.document_mode)
                ret = RawProcessor.dcraw_document_mode_processing();
            else
                ret = RawProcessor.dcraw_process();
                
            if(LIBRAW_SUCCESS !=ret)
                {
                    fprintf(stderr,"Cannot do postpocessing on %s: %s\n",
                            av[i],libraw_strerror(ret));
                    if(LIBRAW_FATAL_ERROR(ret))
                        continue; 
                }
            snprintf(outfn,sizeof(outfn),
                     "%s.%s",
                     av[i], OUT.output_tiff ? "tiff" : (P1.colors>1?"ppm":"pgm"));

            if(verbose) printf("Writing file %s\n",outfn);

            if( LIBRAW_SUCCESS != (ret = RawProcessor.dcraw_ppm_tiff_writer(outfn)))
                fprintf(stderr,"Cannot write %s: %s\n",outfn,libraw_strerror(ret));

            RawProcessor.recycle(); // just for show this call
        }
    return 0;
}
开发者ID:UIKit0,项目名称:digikam,代码行数:101,代码来源:simple_dcraw.cpp

示例3: libraw_dcraw_ppm_tiff_writer

 int  libraw_dcraw_ppm_tiff_writer(libraw_data_t* lr,const char *filename)
 {
     if(!lr) return EINVAL;
     LibRaw *ip = (LibRaw*) lr->parent_class;
     return ip->dcraw_ppm_tiff_writer(filename);
 }
开发者ID:2php,项目名称:ogre-android,代码行数:6,代码来源:libraw_c_api.cpp

示例4: main


//.........这里部分代码省略.........
#define S RawProcessor.imgdata.sizes
#define C RawProcessor.imgdata.color
#define T RawProcessor.imgdata.thumbnail
#define P2 RawProcessor.imgdata.other
#define OUT RawProcessor.imgdata.params

    OUT.document_mode=2;
    OUT.output_bps=16;
    OUT.output_tiff=1;
    OUT.user_flip=0;
    OUT.no_auto_bright = 1;
    OUT.filtering_mode=(LibRaw_filtering)( LIBRAW_FILTERING_NOBLACKS|LIBRAW_FILTERING_NOZEROES);
    for (i=1;i<ac;i++)
        {
            if(av[i][0]=='-')
                {
                    if(av[i][1]=='q' && av[i][2]==0)
                        verbose=0;
                    else if(av[i][1]=='A' && av[i][2]==0)
                        autoscale=1;
                    else if(av[i][1]=='g' && av[i][2]==0)
                        use_gamma = 1;
                    else if(av[i][1]=='N' && av[i][2]==0)
                        OUT.filtering_mode=LIBRAW_FILTERING_NONE;
                    else if(av[i][1]=='s' && av[i][2]==0)
                        {
                            i++;
                            OUT.shot_select=atoi(av[i]);
                        }
                    else
                        goto usage;
                    continue;
                }
            int c;
            if(!use_gamma)
                OUT.gamm[0] = OUT.gamm[1] = 1;
            if(verbose) printf("Processing file %s\n",av[i]);
            if( (ret = RawProcessor.open_file(av[i])) != LIBRAW_SUCCESS)
                {
                    fprintf(stderr,"Cannot open %s: %s\n",av[i],libraw_strerror(ret));
                    continue; // no recycle b/c open file will recycle itself
                }
            if(verbose)
                {
                    printf("Image size: %dx%d\nRaw size: %dx%d\n",S.width,S.height,S.raw_width,S.raw_height);
                    printf("Margins: top=%d, left=%d, right=%d, bottom=%d\n",
                           S.top_margin,S.left_margin,S.right_margin,S.bottom_margin);
                }

            if( (ret = RawProcessor.unpack() ) != LIBRAW_SUCCESS)
                {
                    fprintf(stderr,"Cannot unpack %s: %s\n",av[i],libraw_strerror(ret));
                    continue;
                }

            if(verbose)
                printf("Unpacked....\n");

            if( (ret = RawProcessor.add_masked_borders_to_bitmap() ) != LIBRAW_SUCCESS)
                {
                    fprintf(stderr,"Cannot add mask data to bitmap %s\n",av[i]);
                }

            // move all pixel data to component 0

            for(int r=0;r<S.iheight;r++)
                for(c=0;c<S.iwidth;c++)
                    RawProcessor.imgdata.image[r*S.iwidth+c][0] 
		      = RawProcessor.imgdata.image[r*S.iwidth+c][RawProcessor.COLOR(r,c)];

            P1.colors=1;
            if(autoscale)
                {
                    unsigned max=0,scale;
                    for(int j=0; j<S.iheight*S.iwidth; j++)
                        if(max < RawProcessor.imgdata.image[j][0])
                            max = RawProcessor.imgdata.image[j][0]; 
                    if (max >0 && max< 1<<15)
                        {
                            scale = (1<<16)/max;
                            if(verbose)
                                printf("Scaling with multiplier=%d (max=%d)\n",scale,max);
                            
                            for(int j=0; j<S.iheight*S.iwidth; j++)
                                RawProcessor.imgdata.image[j][0] *= scale;
                        }
                }

            
            if(OUT.shot_select)
                snprintf(outfn,sizeof(outfn),"%s-%d.tiff",av[i],OUT.shot_select);
            else
                snprintf(outfn,sizeof(outfn),"%s.tiff",av[i]);

            if(verbose) printf("Writing file %s\n",outfn);
            if( LIBRAW_SUCCESS != (ret = RawProcessor.dcraw_ppm_tiff_writer(outfn)))
                fprintf(stderr,"Cannot write %s: %s\n",outfn,libraw_strerror(ret));
        }
    return 0;
}
开发者ID:adamhooper,项目名称:libraw-dead,代码行数:101,代码来源:unprocessed_raw.cpp

示例5: main


//.........这里部分代码省略.........
                        {
                            fprintf(stderr,"Cannot open %s: %s\n",argv[arg],strerror(errno));
                            continue;
                        }
                    if(fstat(file,&st))
                        {
                            fprintf(stderr,"Cannot stat %s: %s\n",argv[arg],strerror(errno));
                            close(file);
                            continue;
                        }
					if(!(iobuffer = malloc(st.st_size)))
					{
                                          fprintf(stderr,"Cannot allocate %d kbytes for memory buffer\n",(int)(st.st_size/1024));
						close(file);
						continue;
					}
					int rd;
					if(st.st_size!=(rd=read(file,iobuffer,st.st_size)))
					{
                                          fprintf(stderr,"Cannot read %d bytes instead of  %d to memory buffer\n",(int)rd,(int)st.st_size);
						close(file);
						free(iobuffer);
						continue;
					}
					close(file);
					if( (ret = RawProcessor.open_buffer(iobuffer,st.st_size) != LIBRAW_SUCCESS))
                    {
                            fprintf(stderr,"Cannot open_buffer %s: %s\n",argv[arg],libraw_strerror(ret));
							free(iobuffer);
                            continue; // no recycle b/c open file will recycle itself
                    }
			}
			else
                {
                    if(use_bigfile)
                        // force open_file switch to bigfile processing
                        ret = RawProcessor.open_file(argv[arg],1);
                    else
                        ret = RawProcessor.open_file(argv[arg]);
                        
                    if( ret  != LIBRAW_SUCCESS)
                        {
                            fprintf(stderr,"Cannot open %s: %s\n",argv[arg],libraw_strerror(ret));
                            continue; // no recycle b/c open_file will recycle itself
                        }
                }

            if(use_timing)
                timerprint("LibRaw::open_file()",argv[arg]);


            timerstart();
            if( (ret = RawProcessor.unpack() ) != LIBRAW_SUCCESS)
                {
                    fprintf(stderr,"Cannot unpack %s: %s\n",argv[arg],libraw_strerror(ret));
                    continue;
                }

            if(use_timing)
                timerprint("LibRaw::unpack()",argv[arg]);

            timerstart();
            if (LIBRAW_SUCCESS != (ret = RawProcessor.dcraw_process()))
                {
                    fprintf(stderr,"Cannot do postpocessing on %s: %s\n",argv[arg],libraw_strerror(ret));
                    if(LIBRAW_FATAL_ERROR(ret))
                        continue; 
                }
            if(use_timing)
                timerprint("LibRaw::dcraw_process()",argv[arg]);

            snprintf(outfn,sizeof(outfn),
                     "%s.%s",
                     argv[arg], OUT.output_tiff ? "tiff" : (P1.colors>1?"ppm":"pgm"));

            if(verbosity)
                {
                    printf("Writing file %s\n",outfn);
                }

            if( LIBRAW_SUCCESS != (ret = RawProcessor.dcraw_ppm_tiff_writer(outfn)))
                fprintf(stderr,"Cannot write %s: %s\n",outfn,libraw_strerror(ret));

#ifndef WIN32
            if(use_mmap && iobuffer)
                {
                    munmap(iobuffer,msize);
                    iobuffer=0;
                }
#endif
			else if(use_mem && iobuffer)
			{
				free(iobuffer);
				iobuffer = 0;
			}
            
            RawProcessor.recycle(); // just for show this call
        }
    return 0;
}
开发者ID:jabbervorx,项目名称:LibRaw,代码行数:101,代码来源:dcraw_emu.cpp

示例6: main


//.........这里部分代码省略.........
                    if(av[i][1]=='s' && av[i][2]==0)
                        {
                            i++;
                            OUT.shot_select=atoi(av[i]);
                        }
                    else if(av[i][1]=='g' && av[i][2]==0)
                        use_gamma = 1;
                    else if(av[i][1]=='A' && av[i][2]==0)
                        autoscale=1;
                    else if(av[i][1]=='B' && av[i][2]==0)
                        {
                            black_subtraction=0;
                        }
                    else
                        goto usage;
                    continue;
                }
            if(!use_gamma)
                OUT.gamm[0] = OUT.gamm[1] = 1;
                
            int c;
            printf("Processing file %s\n",av[i]);
            if( (ret = RawProcessor.open_file(av[i])) != LIBRAW_SUCCESS)
                {
                    fprintf(stderr,"Cannot open %s: %s\n",av[i],libraw_strerror(ret));
                    continue; // no recycle b/c open file will recycle itself
                }
            if(P1.is_foveon)
                {
                    printf("Cannot process Foveon image %s\n",av[i]);
                    continue ;
                }
            if( (ret = RawProcessor.unpack() ) != LIBRAW_SUCCESS)
                {
                    fprintf(stderr,"Cannot unpack %s: %s\n",av[i],libraw_strerror(ret));
                    continue;
                }
            RawProcessor.raw2image();
            if(black_subtraction)
                {
                    RawProcessor.subtract_black();
                }

            if(autoscale)
                {
                    unsigned max=0,scale=1;
                    for(int j=0; j<S.iheight*S.iwidth; j++)
                        for(int c = 0; c< 4; c++)
                            if(max < RawProcessor.imgdata.image[j][c])
                                max = RawProcessor.imgdata.image[j][c]; 
                    if (max >0 && max< 1<<15)
                        {
                            scale = (1<<16)/max;
                            printf("Scaling with multiplier=%d (max=%d)\n",scale,max);
                            for(int j=0; j<S.iheight*S.iwidth; j++)
                                for(c=0;c<4;c++)
                                    RawProcessor.imgdata.image[j][c] *= scale;
                        }
		   printf("Black level (scaled)=%d\n",C.black*scale);
                }
		else
		   printf("Black level (unscaled)=%d\n",C.black);


            // hack to make dcraw tiff writer happy
	    int isrgb=(P1.colors==4?0:1);
            P1.colors = 1;
            S.width = S.iwidth;
            S.height = S.iheight;

            for (int layer=0;layer<4;layer++)
                {
                    if(layer>0)
                        {
                            for (int rc = 0; rc < S.iheight*S.iwidth; rc++)
                                RawProcessor.imgdata.image[rc][0] = RawProcessor.imgdata.image[rc][layer];
                        }
		    char lname[8];
		    if(isrgb)
		      {
			snprintf(lname,7,"%c",((char*)("RGBG"))[layer]);
			if(layer==3)
			  strcat(lname,"2");
		      }
		    else
		      snprintf(lname,7,"%c",((char*)("GCMY"))[layer]);

                    if(OUT.shot_select)
                        snprintf(outfn,sizeof(outfn),"%s-%d.%s.tiff",av[i],OUT.shot_select,lname);
                    else
                        snprintf(outfn,sizeof(outfn),"%s.%s.tiff",av[i],lname);
                    
                    printf("Writing file %s\n",outfn);
                    if( LIBRAW_SUCCESS != (ret = RawProcessor.dcraw_ppm_tiff_writer(outfn)))
                        fprintf(stderr,"Cannot write %s: %s\n",outfn,libraw_strerror(ret));
                }

        }
    return 0;
}
开发者ID:coapp-packages,项目名称:LibRaw,代码行数:101,代码来源:4channels.cpp

示例7: main


//.........这里部分代码省略.........
                  return 1;
              }
      }
  putenv ((char*)"TZ=UTC"); // dcraw compatibility, affects TIFF datestamp field
  OUT.filtering_mode = LIBRAW_FILTERING_AUTOMATIC;
#define P1 RawProcessor.imgdata.idata
#define S RawProcessor.imgdata.sizes
#define C RawProcessor.imgdata.color
#define T RawProcessor.imgdata.thumbnail
#define P2 RawProcessor.imgdata.other

  if(verbosity>1)
          RawProcessor.set_progress_handler(my_progress_callback,(void*)"Sample data passed");
#ifdef _OPENMP
  if(verbosity)
          printf ("Using %d threads\n", omp_get_max_threads());
#endif

  for ( ; arg < argc; arg++)
        {
            char outfn[1024];

            if(verbosity) printf("Processing file %s\n",argv[arg]);
#ifndef WIN32
            if(use_mmap)
                {
                    int file = open(argv[arg],O_RDONLY);
                    struct stat st;
                    if(file<0)
                        {
                            fprintf(stderr,"Cannot open %s: %s\n",argv[arg],strerror(errno));
                            continue;
                        }
                    if(fstat(file,&st))
                        {
                            fprintf(stderr,"Cannot stat %s: %s\n",argv[arg],strerror(errno));
                            close(file);
                            continue;
                        }
                    int pgsz = getpagesize();
                    msize = ((st.st_size+pgsz-1)/pgsz)*pgsz;
                    iobuffer = mmap(NULL,msize,PROT_READ,MAP_PRIVATE,file,0);
                    if(!iobuffer)
                        {
                            fprintf(stderr,"Cannot mmap %s: %s\n",argv[arg],strerror(errno));
                            close(file);
                            continue;
                        }
                    close(file);
                    if( (ret = RawProcessor.open_buffer(iobuffer,st.st_size) != LIBRAW_SUCCESS))
                        {
                            fprintf(stderr,"Cannot open_buffer %s: %s\n",argv[arg],libraw_strerror(ret));
                            continue; // no recycle b/c open file will recycle itself
                        }

                }
            else
#endif
                {
                    if( (ret = RawProcessor.open_file(argv[arg])) != LIBRAW_SUCCESS)
                        {
                            fprintf(stderr,"Cannot open %s: %s\n",argv[arg],libraw_strerror(ret));
                            continue; // no recycle b/c open_file will recycle itself
                        }
                }
            if( (ret = RawProcessor.unpack() ) != LIBRAW_SUCCESS)
                {
                    fprintf(stderr,"Cannot unpack %s: %s\n",argv[arg],libraw_strerror(ret));
                    continue;
                }
            if (LIBRAW_SUCCESS != (ret = RawProcessor.dcraw_process()))
                {
                    fprintf(stderr,"Cannot do postpocessing on %s: %s\n",argv[arg],libraw_strerror(ret));
                    if(LIBRAW_FATAL_ERROR(ret))
                        continue; 
                }
            snprintf(outfn,sizeof(outfn),
                     "%s.%s",
                     argv[arg], OUT.output_tiff ? "tiff" : (P1.colors>1?"ppm":"pgm"));

            if(verbosity)
                {
                    printf("Writing file %s\n",outfn);
                }

            if( LIBRAW_SUCCESS != (ret = RawProcessor.dcraw_ppm_tiff_writer(outfn)))
                fprintf(stderr,"Cannot write %s: %s\n",outfn,libraw_strerror(ret));

#ifndef WIN32
            if(use_mmap && iobuffer)
                {
                    munmap(iobuffer,msize);
                    iobuffer=0;
                }
#endif
            
            RawProcessor.recycle(); // just for show this call
        }
    return 0;
}
开发者ID:adamhooper,项目名称:libraw-dead,代码行数:101,代码来源:dcraw_emu.cpp


注:本文中的LibRaw::dcraw_ppm_tiff_writer方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。