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


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

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


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

示例1: main

int main(int ac, char *av[])
{
    int  i, ret;
    int autoscale=0,black_subtraction=1, use_gamma=0;
    char outfn[1024]; 

    LibRaw RawProcessor;
    if(ac<2) 
        {
          usage:
            printf(
                "4channeld - LibRaw %s sample. %d cameras supported\n"
                "Usage: %s [-s N] [-g] [-A] [-B] [-N] raw-files....\n"
                "\t-s N - select Nth image in file (default=0)\n"
                "\t-g - use gamma correction with gamma 2.2 (not precise,use for visual inspection only)\n"
                "\t-A - autoscaling (by integer factor)\n"
                "\t-B - no black subtraction\n"
                ,LibRaw::version(),
                LibRaw::cameraCount(),
                av[0]);
            return 0;
        }
    
#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

    OUT.document_mode=2;
    OUT.output_bps=16;
    OUT.output_tiff=1;
    OUT.user_flip=0;
    OUT.no_auto_bright = 1;
    OUT.half_size=1;

    for (i=1;i<ac;i++)
        {
            if(av[i][0]=='-')
                {
                    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);
//.........这里部分代码省略.........
开发者ID:coapp-packages,项目名称:LibRaw,代码行数:101,代码来源:4channels.cpp

示例2: libraw_subtract_black

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

示例3: main

int main(int ac, char *av[])
{
    int  i, ret;
    int verbose=1,autoscale=0,use_gamma=0,add_borders=0,subtract_black=0;
    char outfn[1024];

    LibRaw RawProcessor;
    if(ac<2)
    {
usage:
        printf(
            "unprocessed_raw - LibRaw %s sample. %d cameras supported\n"
            "Usage: %s [-q] [-A] [-g] [-s N] [-N] raw-files....\n"
            "\t-q - be quiet\n"
            "\t-s N - select Nth image in file (default=0)\n"
            "\t-M - add black (masked) pixels data to bitmap\n"
            "\t-B - subtract black level from pixel data\n"
            "\t-g - use gamma correction with gamma 2.2 (not precise,use for visual inspection only)\n"
            "\t-A - autoscaling (by integer factor)\n"
            "\t-N - no raw curve/zeroes filtering\n"
            ,LibRaw::version(),
            LibRaw::cameraCount(),
            av[0]);
        return 0;
    }

#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

    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_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]=='M' && av[i][2]==0)
                add_borders = 1;
            else if(av[i][1]=='B' && av[i][2]==0)
                subtract_black = 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;
        }
        if(add_borders && subtract_black)
        {
            fprintf(stderr,"Cannot add masked pixels data and subtract black simultaneously\n");
            exit(1);
        }
        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(add_borders)
            if( (ret = RawProcessor.add_masked_borders_to_bitmap() ) != LIBRAW_SUCCESS)
            {
                fprintf(stderr,"Cannot add mask data to bitmap %s\n",av[i]);
            }
        if(subtract_black)
//.........这里部分代码省略.........
开发者ID:ashmind,项目名称:LibRaw,代码行数:101,代码来源:unprocessed_raw.cpp


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