Christoph John wrote:
> Hello together, I have a little question concerning the right usage of vil.
> I have an unsigned char* imgData in RGBRGB... order. I am trying to wrap an view around the resource and copy it into another resource with put_view.
> How are the parameters for vil_new_image_resource and vil_image_view?
> Thanks for your help.
The following constructor is used to wrap a view around
a block of memory.
// Set this view to look at someone else's memory data.
vil_image_view::vil_image_view (const T *top_left,
unsigned ni, unsigned nj, unsigned nplanes,
vcl_ptrdiff_t i_step, vcl_ptrdiff_t j_step,
//For a single-plane RGB image
vil_image_view<vil_rgb<vxl_byte> > my_rgb_view(imgData,
ni, nj, 1,
1, ni, ni*nj);
// For a 3-plane ni x nj image
ni, nj, 3,
3, 3*ni, 1);
To wrap an image_resource around that, use
vil_image_view_base const & view);
vil_image_resource_sptr my_resource = vil_new_image_resource_of_view(
vil_image_view_base const & my_3plane_view);