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


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

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


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

示例1: error

bool
RawInput::process()
{
    if (!m_image) {
        int ret = m_processor.dcraw_process();
        if (ret != LIBRAW_SUCCESS) {
            error("Processing image failed, %s", libraw_strerror(ret));
            return false;
        }

        m_image = m_processor.dcraw_make_mem_image(&ret);
        if (!m_image) {
            error("LibRaw failed to create in memory image");
            return false;
        }

        if (m_image->type != LIBRAW_IMAGE_BITMAP) {
            error("LibRaw did not return expected image type");
            return false;
        }

        if (m_image->colors != 3) {
            error("LibRaw did not return 3 channel image");
            return false;
        }

    }
    return true;
}
开发者ID:HughMacdonald,项目名称:gafferDependencies,代码行数:29,代码来源:rawinput.cpp

示例2: loadMaster

Image ImageLoader_raw_p::loadMaster ()
{
    /**
      * Custom raw import:
      * half_size = 1
      * document_mode = 2
      * gamma[0] gamma[1] = 1
      */


    // Skip debayer for now
    m_rawProcessor.imgdata.params.half_size = 0;
    m_rawProcessor.imgdata.params.document_mode = 0;

    m_rawProcessor.imgdata.params.use_camera_wb = 1;
    m_rawProcessor.imgdata.params.use_auto_wb = 0;
    m_rawProcessor.imgdata.params.med_passes = 0;
    m_rawProcessor.imgdata.params.no_auto_bright = 1;

    m_rawProcessor.imgdata.params.output_color = 1; // sRGB
    m_rawProcessor.imgdata.params.output_bps = 16;  // 16 bits

    m_rawProcessor.unpack();

    // Use AHC bayer interpolation
    m_rawProcessor.imgdata.params.user_qual = 1;

    m_rawProcessor.imgdata.params.threshold = 100;
    if (m_rawProcessor.imgdata.other.iso_speed)
        m_rawProcessor.imgdata.params.threshold = m_rawProcessor.imgdata.other.iso_speed / 8; // TODO  /8 beter?

    m_rawProcessor.dcraw_process();

    int mem_height = 0;
    int mem_width = 0;
    int mem_channels = 0;
    int mem_bits_per_pixel = 0;

    m_rawProcessor.get_mem_image_format(&mem_width, &mem_height, &mem_channels, &mem_bits_per_pixel);

    QSize size (mem_width, mem_height);

    qDebug () << "Create rawprocessor image:";
    qDebug () << mem_width << mem_height << mem_channels << mem_bits_per_pixel;

    Image image (size, mem_channels, size.width() * mem_channels * mem_bits_per_pixel, mem_bits_per_pixel);

//    image.setMaxValue( m_rawProcessor.imgdata.color.maximum );

    m_rawProcessor.copy_mem_image(image.pixels(), image.step(), 0);

    return image;
}
开发者ID:SimonEverts,项目名称:plok-photomanager,代码行数:53,代码来源:imageloader_raw.cpp

示例3: 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

示例4: main

int main(int ac, char *av[])
{
    int  i, ret, verbose=0, output_thumbs=0;

    // don't use fixed size buffers in real apps!
    char outfn[1024],thumbfn[1024]; 

    LibRaw RawProcessor;
    if(ac<2) 
        {
            printf(
                "simple_dcraw - LibRaw %s sample. Emulates dcraw [-D] [-T] [-v] [-e] [-E]\n"
                " %d cameras supported\n"
                "Usage: %s [-D] [-T] [-v] [-e] raw-files....\n"
                "\t-D - document mode emulation\n"
                "\t-4 - 16-bit mode\n"
                "\t-v - verbose output\n"
                "\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",
//.........这里部分代码省略.........
开发者ID:UIKit0,项目名称:digikam,代码行数:101,代码来源:simple_dcraw.cpp

示例5: libraw_dcraw_process

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

示例6: 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

示例7: main

int main(int ac, char *av[])
{
    int  i, ret, output_thumbs=0;

    // don't use fixed size buffers in real apps!

    LibRaw RawProcessor;
    
    if(ac<2) 
        {
            printf(
                "mem_image - LibRaw sample, to illustrate work for memory buffers. Emulates dcraw [-4] [-1] [-e] [-h]\n"
                "Usage: %s [-D] [-T] [-v] [-e] raw-files....\n"
                "\t-6 - output 16-bit PPM\n"
                "\t-4 - linear 16-bit data\n"
                "\t-e - extract thumbnails (same as dcraw -e in separate run)\n",
                "\t-h - use half_size\n");
            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]=='6' && av[i][2]==0)
                        OUT.output_bps = 16;
                    if(av[i][1]=='4' && av[i][2]==0)
                        {
                            OUT.output_bps = 16;
                            OUT.gamm[0] = OUT.gamm[1] =  OUT.no_auto_bright    = 1;
                        }
                    if(av[i][1]=='e' && av[i][2]==0)
                        output_thumbs++;
                    if(av[i][1]=='h' && av[i][2]==0)
                        OUT.half_size=1;
                    continue;
                }
            printf("Processing %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( (ret = RawProcessor.unpack() ) != LIBRAW_SUCCESS)
                {
                    fprintf(stderr,"Cannot unpack %s: %s\n",av[i],libraw_strerror(ret));
                    continue;
                }

            // we should call dcraw_process before thumbnail extraction because for
            // some cameras (i.e. Kodak ones) white balance for thumbnal should be set
            // from main image settings


            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; 
                }
            libraw_processed_image_t *image = RawProcessor.dcraw_make_mem_image(&ret);
            if(image)
                {
                    write_ppm(image,av[i]);
                    LibRaw::dcraw_clear_mem(image);
                }
            else
                fprintf(stderr,"Cannot unpack %s to memory buffer: %s\n" , av[i],libraw_strerror(ret));

            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
                        {
                            libraw_processed_image_t *thumb = RawProcessor.dcraw_make_mem_thumb(&ret);
                            if(thumb)
                                {
                                    write_thumb(thumb,av[i]);
                                    LibRaw::dcraw_clear_mem(thumb);
                                }
//.........这里部分代码省略.........
开发者ID:KingBing,项目名称:LibRaw,代码行数:101,代码来源:mem_image.cpp

示例8: main


//.........这里部分代码省略.........
                case 'a': 
                    OUT.use_auto_wb = 1;  
                    break;
                case 'H':
                    OUT.highlight   = atoi(argv[arg++]);  
                    break;
                case 'q':
                    OUT.user_qual   = atoi(argv[arg++]);  
                    break;
                case 'h':  
                    OUT.half_size = 1;		
                    OUT.four_color_rgb    = 1;  
                    shrink = 1;
                    break;
                case 'm':
                    OUT.med_passes  = atoi(argv[arg++]);  
                    break;
                case 'n':  
                    OUT.threshold   = (float)atof(argv[arg++]);  
                    break;
                case 's':  
                    OUT.shot_select = abs(atoi(argv[arg++])); 
                    break;
                case 'B':  
                  for(c=0; c<4;c++) OUT.cropbox[c]  = atoi(argv[arg++]); 
                  break;
                case 'R':  
                    rep = abs(atoi(argv[arg++])); 
                    if(rep<1) rep = 1;
                    break;
				case 'c':
					OUT.use_rawspeed = 0;
					break;
                default:
                    fprintf (stderr,"Unknown option \"-%c\".\n", opt);
                    return 1;
                }
        }
    for ( ; arg < argc; arg++)
        {
            printf("Processing file %s\n",argv[arg]);
			timerstart();
			if( (ret = RawProcessor.open_file(argv[arg])) != LIBRAW_SUCCESS)
                {
                    fprintf(stderr,"Cannot open_file %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;
                }
			float qsec = timerend();
			printf("\n%.1f msec for unpack\n",qsec);
            float mpix,rmpix;
            timerstart();
            for(c=0; c < rep; c++)
                {
                    if( (ret = RawProcessor.dcraw_process() ) != LIBRAW_SUCCESS)
                        {
                            fprintf(stderr,"Cannot postprocess %s: %s\n",argv[arg],libraw_strerror(ret));
                            break;
                        }
                    libraw_processed_image_t *p = RawProcessor.dcraw_make_mem_image();
                    if(p)
                        RawProcessor.dcraw_clear_mem(p);
                    RawProcessor.free_image();
                }
            float msec = timerend()/(float)rep;

            if( (ret = RawProcessor.adjust_sizes_info_only() ) != LIBRAW_SUCCESS)
                {
                    fprintf(stderr,"Cannot adjust sizes for %s: %s\n",argv[arg],libraw_strerror(ret));
                    break;
                }
            rmpix = (S.iwidth*S.iheight)/1000000.0f;

            if(c==rep) // no failure
                {
                    unsigned int crop[4];
                    for(int i=0;i<4;i++) crop[i] = (OUT.cropbox[i])>>shrink;
                    if(crop[0]+crop[2]>S.iwidth) crop[2] = S.iwidth-crop[0];
                    if(crop[1]+crop[3]>S.iheight) crop[3] = S.iheight-crop[1];

                    mpix = float(crop[2]*crop[3])/1000000.0f;
                    float mpixsec = mpix*1000.0f/msec;

                    printf(
                        "Performance: %.2f Mpix/sec\n"
                        "File: %s, Frame: %d %.1f total Mpix, %.1f msec\n"
                        "Params:      WB=%s Highlight=%d Qual=%d HalfSize=%s Median=%d Wavelet=%.0f\n"
                        "Crop:        %u-%u:%ux%u, active Mpix: %.2f, %.1f frames/sec\n",
                        mpixsec
                        ,argv[arg],OUT.shot_select,rmpix,msec,
                        OUT.use_auto_wb?"auto":"default",OUT.highlight,OUT.user_qual,OUT.half_size?"YES":"No",
                        OUT.med_passes,OUT.threshold,
                        crop[0],crop[1],crop[2],crop[3],mpix,1000.0f/msec);
                }
        }
开发者ID:,项目名称:,代码行数:101,代码来源:

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