Hi Néstor,

Nestor Morales Hernández wrote:

I currently have an image of the type ` boost::gil::rgb8c_view_t`. I need to pass it to a function (from a code I don't mantain) with this prototype:

void function(const boost::gil::rgb8c_view_t& input, const int index, const boost::gil::rgb8c_view_t::view_t &output)

I have created an output image by using the following syntax:

boost::gil::rgb8c_view_t::view_t output(input._dynamic_cast<boost::gil::rgb8c_view_t::view_t>());

At this point, the compiler accepts the image output as input for the function. However, I need the image back to the `boost::gil::rgb8c_view_t` type. The question is:

- Is it a correct way to allocate the image output?
- How do I transform it back to the type boost::gil::rgb8c_view_t?


I'm having trouble parsing your syntax here.  It looks like input is not really an rgb8c_view_t, rather its an any_image type.  If it were the gil-specified typedef, there wouldn't be a _dynamic_cast member.  Likewise output appears to be the same, with a nested view_t typedef.

Are you saying that function is the prototype over which you have no control?  It seems odd that it would have an output view which has immutable pixels (due to the 'c' in rgb8c) and which could not itself be swapped out for a different view (due to the fact that it's a view passed by const reference).

I'm hoping there's been some mistake in copying pieces of your code into this email, otherwise there's only bad solutions to what you describe.

HTH,
Nate