阅读与吉尔png图片 [英] Reading png images with gil

查看:164
本文介绍了阅读与吉尔png图片的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有可能与的boost ::吉尔读取RGB图像信息,这样我可以读取该文件到正确的 rgbx_image_t

使用以下我必须事先知道的类型,这是不那么整齐。

 的boost ::吉尔:: rgb8_image_t IM;
吉尔:: png_read_image(m_filename,即时通讯);


解决方案

可以让你想尝试并使用 any_image 持有类型 - 一个类型列表擦除结果是:

 的typedef MPL ::矢量< rgb8_image_t,rgb16_image_t> my_img_types;
any_image< my_img_types> runtime_image;
png_read_image(input.png,runtime_image);

来源

Is it possible with boost::gil to read the RGB image information so that I can read the file into the correct rgbx_image_t?

With the following I have to know the type beforehand and that is not so neat.

boost::gil::rgb8_image_t im;
gil::png_read_image(m_filename, im);

解决方案

You can make a list of types you want to try and use an any_image to hold a type-erased result:

typedef mpl::vector<rgb8_image_t, rgb16_image_t> my_img_types;
any_image<my_img_types> runtime_image;
png_read_image("input.png", runtime_image);

Source

这篇关于阅读与吉尔png图片的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆