本文整理汇总了C++中FileLoader::colorspace方法的典型用法代码示例。如果您正苦于以下问题:C++ FileLoader::colorspace方法的具体用法?C++ FileLoader::colorspace怎么用?C++ FileLoader::colorspace使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FileLoader
的用法示例。
在下文中一共展示了FileLoader::colorspace方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: argp
int
main(int argc, char** argv)
{
ArgumentParser argp(argc, argv, "uw:h:c:");
if ( argp.num_items() != 2 )
{
print_usage(argp.program_name());
printf("\nInvalid number of files given\n\n");
return -1;
}
const char *fn_in = argp.items()[0];
const char *fn_out = argp.items()[1];
char* fn_out_copy = strdup(fn_out);
printf("Input file: %s\n"
"Output file: %s\n",
fn_in, fn_out);
// strip off extension
char *t = strtok(fn_out_copy, ".");
if (NULL == t)
{
printf("invalid filename");
return -2;
}
char* ext_out;
while(NULL != t)
{
ext_out = t;
t = strtok(NULL, ".");
}
FileLoader *fl = NULL;
Writer* writer = NULL;
if ( argp.has_arg("u") )
{
if (argp.has_arg("c") && argp.has_arg("w") && argp.has_arg("h"))
{
fl = new FileLoader(colorspace_by_name(argp.arg("c")), fn_in,
argp.parse_int("w"), argp.parse_int("h"));
printf("Input image: %s, %lix%li\n", argp.arg("c"),
argp.parse_int("w"), argp.parse_int("h"));
}
else
{
printf("You have to supply all of -w, -h, -c when using -u.\n");
return -3;
}
}
else
{
fl = new FileLoader(fn_in);
}
fl->open();
fl->start();
unsigned char *tmpbuf = malloc_buffer(YUV422_PLANAR, fl->pixel_width(), fl->pixel_height());
convert(fl->colorspace(), YUV422_PLANAR, fl->buffer(), tmpbuf,
fl->pixel_width(), fl->pixel_height());
// FvRaw
if ( 0 == strcmp(ext_out, "raw") )
{
printf("Format for out file %s is FvRaw\n", fn_out);
writer = new FvRawWriter();
}
#ifdef HAVE_LIBJPEG
// JPEG
else if ( 0 == strcmp(ext_out, "jpeg") || 0 == strcmp(ext_out, "jpg") )
{
printf("Format for out file %s is Jpeg\n", fn_out);
writer = new JpegWriter();
}
#endif
#ifdef HAVE_LIBPNG
// PNG
else if ( 0 == strcmp(ext_out, "png") )
{
printf("Format for out file %s is PNG\n", fn_out);
writer = new PNGWriter();
}
#endif
// PNM
else if ( 0 == strcmp(ext_out, "pnm") )
{
printf("Format for out file %s is PNM\n", fn_out);
writer = new PNMWriter(PNM_PPM);
}
else
{
printf("Unknown output file format\n");
exit(-2);
}
writer->set_filename(fn_out);
//.........这里部分代码省略.........