Re: [boost] [GIL] kth_channel_view

A good example of using kth_channel_view is this:
rgb8_image_t img( 100, 100 ); typedef typename kth_channel_view_type< 0, const rgb8_view_t>::type view_t; view_t first = kth_channel_view<0>( const_view( img ));
Another interesting possibility is: typedef kth_channel_view_type< 0, const rgb8_view_t> KthChannelView; typename KthChannelView::type first = KthChannelView::make( const_view(img) ); It can be a good thing to directly use channel type, like this: typedef channel_view_type< red_t, const rgb8_view_t>::type view_t; view_t first = channel_view<red_t>( const_view( img )); I have written some code to do that, based on kth_channel_view_type. It's maybe intersting to include in gil. Regards, Fabien namespace boost { namespace gil { template <typename Channel, typename View> struct channel_type_to_index { static const int value = gil::detail::type_to_index< typename color_space_type<View>::type, // color (mpl::vector) Channel // channel type >::type::value; //< index of the channel in the color (mpl::vector) }; template <typename Channel, typename View> struct channel_view_type : public kth_channel_view_type<channel_type_to_index<Channel,View>::value, View> { static const int index = channel_type_to_index<Channel,View>::value; typedef kth_channel_view_type<index, View> parent_t; typedef typename parent_t::type type; static type make(const View& src) { return parent_t::make(src); } }; /// \ingroup ImageViewTransformationsKthChannel template <typename Channel, typename View> typename channel_view_type<Channel,View>::type channel_view(const View& src) { return channel_view_type<Channel,View>::make(src); } }}

Hi Fabien, I know it took a while but I've some time to see what's going on.
Another interesting possibility is: typedef kth_channel_view_type< 0, const rgb8_view_t> KthChannelView; typename KthChannelView::type first = KthChannelView::make( const_view(img) );
This doesn't compile on my machine. VC10 is the compiler I'm using. Stripping the const's helps me: typedef kth_channel_view_type< 0, rgb8_view_t> KthChannelView; KthChannelView::type first = KthChannelView::make( view( img ) ); Does it work on your machine?
It can be a good thing to directly use channel type, like this: typedef channel_view_type< red_t, const rgb8_view_t>::type view_t; view_t first = channel_view<red_t>( const_view( img ));
Same here. This works: typedef channel_view_type< red_t, rgb8_view_t>::type view_t; view_t first_ = channel_view< red_t >( view( img ));
I have written some code to do that, based on kth_channel_view_type. It's maybe intersting to include in gil.
Thanks! I have added this code to the toolbox extension. See here: http://code.google.com/p/gil-contributions/source/browse/trunk/gil_2/boost/g... Regards, Christian
participants (2)
-
Christian Henning
-
fabien.castan@free.fr