
Thank you Christian.
2009/1/27 Christian Henning
Mhmm, somehow I screwed up. The following compiles fine now:
int main ( int argc , char **argv) { typedef boost::mpl::vector< boost::gil::gray8_image_t, boost::gil::gray16_image_t, boost::gil::gray32_image_t, boost::gil::rgb8_image_t, boost::gil::rgb16_image_t, boost::gil::rgb32_image_t > my_img_types;
typedef boost::mpl::vector< boost::gil::gray8_view_t, boost::gil::gray16_view_t, boost::gil::gray32_view_t, boost::gil::rgb8_view_t, boost::gil::rgb16_view_t, boost::gil::rgb32_view_t > my_view_types;
boost::gil::any_image
runtime_image; boost::gil::any_image_view runtime_view; runtime_view = boost::gil::nth_channel_view( const_view(runtime_image) , 0 );
return 0; }
But when running I'm getting a bad_cast exception. What would you expect the retrieve from nth_channel_view call? I mean what can of image type is the correct one?
Since it extracts one channel from an image, I thought I could retrieve one of the following : boost::gil::gray8_view_t, boost::gil::gray16_view_t or boost::gil::gray32_view_t. I am probably wrong, but is there a way to achieve such a task ? Regards, Olivier
Christian
On Tue, Jan 27, 2009 at 3:31 PM, Olivier Tournaire
wrote: 2009/1/27 Christian Henning
Hi Oliver,
Hi Christian,
I don't get it to compile even when you put the nth_channel_view call inside jpeg_write_view for a simple reason. nth_channel_view needs the reference type of your any_image. But that's not possible since no one knows what image type the any_image actually is. You can cast your any_image to a specific image type using gil's variant::_dynamic_cast member. Then you can use nth_channel_view.
Are you sure your code compiles? Let me know if you keep having
troubles.
Yes, my code compiles fine with boost 1.36. In attachement, maybe you
could
try.
Regards, Olivier
Regards, Christian _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
-- Olivier Tournaire MATIS - Institut Géographique National 73, Ave de Paris 94165 St Mandé cedex, France
tel: (+33) 1 43 98 80 00 - 71 25 fax: (+33) 1 43 98 85 81
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
-- Olivier Tournaire MATIS - Institut Géographique National 73, Ave de Paris 94165 St Mandé cedex, France tel: (+33) 1 43 98 80 00 - 71 25 fax: (+33) 1 43 98 85 81