|
Boost : |
From: Andreas Pokorny (andreas.pokorny_at_[hidden])
Date: 2007-09-03 12:13:22
Hello there,
I try to write a generic floyd steinberg implementation using
boost.gil. Within that
I have to compute the error the color conversion. So I thought that I
simply have to
take a signed version of the pixel type, and compute the difference between the
original and converted pixel.
This operation is supposed to compute the error:
template<typename CT>
struct calc_error {
template <typename Out, typename T>
CT operator()(const Out& in1, const T& orig) const {
return orig - in1;
}
};
Inside the algorithm I do the following:
typedef typename channel_type<OriginalView>::type channel_t;
typedef typename channel_convert_to_signed<channel_t>::type
signed_channel_t;
typedef boost::gil::pixel<
signed_channel_t,
typename OriginalView::value_type::layout_t
> error_pixel_t;
But somehow singed_channel_t is still unsigned char if an rgb8 image
is passed to
the method. Which causes problems in the second stage of the algorithm where
these always positive values are added to the channels.
error_pixel_t error;
static_transform(*conv_it, *orig_it, error,
calc_error<signed_channel_t>());
//....
Regards
Andreas Pokorny
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk