Menu

Retrieving channel's base value type

Hugo
2008-07-03
2013-04-29
  • Hugo

    Hugo - 2008-07-03

    Hi,

    In order to build an histogram from an image view, I need to retrieve channels' base value type. Unfortunately it does not work for channels that use scoped_channel_value as value_type.

    For the moment, I have added : typedef BaseChannelValue base_type; in scoped_channel_value's declaration. Yet, it's not a viable solution, especially if other people use my program.

    Is there another way to retrieve the BaseChannelValue from a scoped_channel_value ?

    Best regards,

    Hugo

     
    • Lubomir Bourdev

      Lubomir Bourdev - 2008-07-07

      Hugo,

      You can always do something non-intrusive like your own metafunction:

      template <typename Channel>
      struct base_channel_value {
          typedef typename channel_traits<Channel>::value_type type;
      };

      template <typename BaseChannelValue, typename MinVal, typename MaxVal>
      struct scoped_channel_value {
          typedef BaseChannelValue type;
      };

      Lubomir

       
    • Lubomir Bourdev

      Lubomir Bourdev - 2008-07-07

      Sorry I meant the second one to be specialization:

      template <typename BaseChannelValue, typename MinV, typename MaxV>
      struct base_channel_value<scoped_channel_value<BaseChannelValue,MinV,MaxV> > {
          typedef BaseChannelValue type;
      };

       

Log in to post a comment.

MongoDB Logo MongoDB