本文整理汇总了C++中LibRaw::dcraw_make_mem_image方法的典型用法代码示例。如果您正苦于以下问题:C++ LibRaw::dcraw_make_mem_image方法的具体用法?C++ LibRaw::dcraw_make_mem_image怎么用?C++ LibRaw::dcraw_make_mem_image使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LibRaw
的用法示例。
在下文中一共展示了LibRaw::dcraw_make_mem_image方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例2:
libraw_processed_image_t *libraw_dcraw_make_mem_image(libraw_data_t* lr,int *errc)
{
if(!lr) { if(errc) *errc=EINVAL; return NULL;}
LibRaw *ip = (LibRaw*) lr->parent_class;
return ip->dcraw_make_mem_image(errc);
}
示例3: 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);
}
//.........这里部分代码省略.........
示例4: 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);
}
}