[Boost-users] [GIL] color_converted_view usage problem

32 views
Skip to first unread message

Marc-Antoine ARNAUD

unread,
May 29, 2012, 6:28:26 AM5/29/12
to boost...@lists.boost.org
Hi guys,


I currently working on TuttleOFX projet, and using Boost GIL to perform some image process.
I wan't using color_converted_view to process clamping values on a view, witth a specific ColorConvert (CC) functor.

But with the actual code [https://github.com/tuttleofx/TuttleOFX/blob/master/libraries/terry/src/terry/clamp.hpp] , the pixel_clamp contructor was corretly called, but our functor (void operator()( const SPixel& src, DPixel& dst ) const) wasn't.
Does someone have the same bug ?
Are they more documentation anywhere on this function ( I'm refering on this link:http://stlab.adobe.com/gil/html/group___image_view_transformations_color_convert.html )


Thanks,
--
Marc-Antoine

Christian Henning

unread,
May 30, 2012, 4:35:15 PM5/30/12
to boost...@lists.boost.org
Hi Marc,

are you aware of scoped_channel_value? Here a small example:

// Create a double channel with range [-0.5 .. 0.5]
struct double_minus_half { static double apply() { return -0.5; } };
struct double_plus_half { static double apply() { return 0.5; } };
typedef scoped_channel_value<double, double_minus_half,
double_plus_half> bits64custom_t;

// channel_convert its maximum should map to the maximum
bits64custom_t x = channel_traits<bits64custom_t>::max_value();
assert(x == 0.5);
bits16 y = channel_convert<bits16>(x);
assert(y == 65535);

Let me know. If that doesn't help I'll dig deeper into your problem.


Regards,
Christian
> _______________________________________________
> Boost-users mailing list
> Boost...@lists.boost.org
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
_______________________________________________
Boost-users mailing list
Boost...@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-users

Marc-Antoine ARNAUD

unread,
May 31, 2012, 10:35:19 AM5/31/12
to boost...@lists.boost.org
Hi Christian,

Thank for your reply, but I continued to investigate on my problem and in fact I found the problem.
The function color_converted_view only process pixel if they are differents which is not our case, we want to process every time.

To change that, I copy the code from GIL and modify what I wan't to process every times (https://github.com/tuttleofx/TuttleOFX/blob/develop/libraries/terry/src/terry/clamp.hpp), which correct my problem.

Marc-Antoine


2012/5/30 Christian Henning <chhe...@gmail.com>

Christian Henning

unread,
Jun 2, 2012, 12:38:26 PM6/2/12
to boost...@lists.boost.org
Hello Marc,


On Thu, May 31, 2012 at 10:35 AM, Marc-Antoine ARNAUD
<m...@mikrosimage.eu> wrote:
> Hi Christian,
>
> Thank for your reply, but I continued to investigate on my problem and in
> fact I found the problem.
> The function color_converted_view only process pixel if they are differents
> which is not our case, we want to process every time.

What do you mean by "only process if they are different"? You mean the
destination type?

Good to see you fixed the problem yourself. May I ask why you don't
use scoped_channel_value? I seems that your channel_clamp class might
be similar.

Regards,
Christian
Reply all
Reply to author
Forward
0 new messages