Boost logo

Boost Users :

Subject: [Boost-users] [GIL] Problem trying to use scoped_channel_value with copy_and_convert_pixels
From: Gabriel Marcano (gabemarcano_at_[hidden])
Date: 2015-01-08 16:13:45


I have been experimenting with Boost.GIL, and I have run into something
that I'm not sure if it's a problem on my end or with Boost.GIL. In
essence, I'm trying to make a grayscale image with channels limited to
14 bits. I am using scoped_channel_value to do this. The problem
happens when I try to convert the 14 bit image to a 16 bit grayscale
image I get compilation errors. I am including the code I am using
below:

//START CODE

    #include <boost/gil/gil_all.hpp>
    #include <cstdint>

    using namespace std;
    using namespace boost::gil;

    namespace detail
    {
        struct bits14_min { static std::uint16_t apply() { return 0;} };
        struct bits14_max
           { static std::uint16_t apply() { return 0x3FF;} };
    }

    typedef scoped_channel_value
        <std::uint16_t,
            ::detail::bits14_min, ::detail::bits14_max> bits14_t;

    typedef pixel<bits14_t, gray_layout_t> Pixel1;
    typedef image<Pixel1> Frame1;

    int main()
    {
        Frame1 image(
            Frame1::point_t(100, 100),
            Frame1::value_type((1 << 14)-1),
            0);

        gray16_image_t image2(image.dimensions());

        Frame1::view_t view1(view(image));
        gray16_image_t::view_t view2(view(image2));

        copy_and_convert_pixels(view1, view2);

        return 0;
    }

//END CODE

The interesting thing is that the program compiles if change
    typedef scoped_channel_value
        <std::uint16_t,
            ::detail::bits14_min, ::detail::bits14_max> bits14_t;
to
    typedef scoped_channel_value
        <float,
            ::detail::bits14_min, ::detail::bits14_max> bits14_t;

I think the relevant error in the log is this:
    /usr/include/boost/gil/channel_algorithm.hpp:54:8: error:
        â€˜struct boost::gil::scoped_channel_value<short unsigned
        int, detail::bits14_min, detail::bits14_max>’ is not a
        valid type for a template non-type parameter
         struct unsigned_integral_max_value : public
             mpl::integral_c<UnsignedIntegralChannel,-1> {};

I am attaching the full compile log to this email. Thank you for any
help with this matter!

Sincerely,

Gabriel E. Marcano




Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net