|
Boost Users : |
Subject: [Boost-users] [gil] any_image* conversion to concrete type
From: Jan Boehme (jan.boehme_at_[hidden])
Date: 2009-01-14 05:02:04
Hi, the following sample code introduces my problem:
#include <boost/gil/extension/dynamic_image/dynamic_image_all.hpp>
#include <boost/mpl/vector.hpp>
#include <boost/gil/extension/io/jpeg_dynamic_io.hpp>
int main() {
using namespace boost::gil;
typedef boost::mpl::vector<rgb8_image_t, cmyk16_planar_image_t> images_t;
typedef any_image<images_t> any_image_t;
typedef any_image_view<boost::mpl::vector2<rgb8_view_t,
cmyk16_planar_view_t > > any_view_t;
typedef any_image_view<boost::mpl::vector2<rgb8c_view_t,
cmyk16c_planar_view_t> > any_const_view_t;
any_image_t img;
jpeg_read_image("test2.jpg", img);
any_const_view_t cview( img );
rgb8c_view_t rgb_view = cview;
}
In the last line I want to convert the any_const_view to a concrete
type what runs fail in lack of a member named 'pixels'.
Does anyone know about that kind of conversion as the documentation
imho doesn't contain such a sample.
Right now I have to copy the pixels in the following form but I can't
believe that this is necessary:
rgb8_image_t rgb_image(img.dimensions());
copy_pixels(color_converted_view<rgb8_pixel_t>(const_view(img)),
view(rgb_image));
rgb8c_view_t rgb8c_view( const_view(rgb_image) );
Thanks a lot, Jan.
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net