Boost logo

Boost :

From: Christian Henning (chhenning_at_[hidden])
Date: 2007-04-23 22:22:36

Thanks John, below my thoughts.

On 4/23/07, John Femiani <JOHN.FEMIANI_at_[hidden]> wrote:
> Christian,
> First off, I think the semantics of color_convert already handle this.
> That function maps the min and max value of the source channel type to
> the min and max value of the target channel type.

When converting an image there is no guarantee for example that the
red channel has values that are the actually min or max. Maybe the min
is 92 or the max is 21000 for a rgb16_pixel_t. Thats why I explicitly
look for the min and max values.

> 1. I think you can use type traits. boost::is_integral<T>::value tells
> you if it is an integer data, and boost::is_signed tells you whether or
> not it is -- well, signed. Just #include<boost/type_traits.hpp>.
Awesome, that works.

   typedef channel_type<rgb8_pixel_t>::type unsigned_t;
   typedef channel_type<rgb8s_pixel_t>::type signed_t;

   // prints 0
   cout << is_signed<unsigned_t>::value << endl;

   // prints 1
   cout << is_signed<signed_t>::value << endl;

> 2. I think you can write a multifunction and pass it into
> boost::gil::static_for_each. Create a class and make a templatized
> member function operator()(T1 src, T2& dst) that does the special
> conversion you want. Use enable_if and disable_if from
> <boost/utility.hpp> to specialize the member function.
What do you mean with multifunction? Do you have an example somewhere?
I don't understand.

> 3. the xxx8_image_t is not a real type -- it is a typedef from
> image<pixel<uint8, xxx_layout_t>, false>.
How do you get the layout type of a view?

Again, thanks a lot for the answers,

Boost list run by bdawes at, gregod at, cpdaniel at, john at