From: Amitha P. <ami...@us...> - 2011-02-06 08:11:44
|
On 02/04/2011 04:30 PM, Michael Repucci wrote: > But now I need to know what the different planes are, so I can know > which ones to use when I need to display the image or combine > information across planes. [...] vxl does not have a way to attach semantic labels to the plane indices. > If not, then let's assume I can get that information from somewhere > else. Question (2): how can I create a view from nativeView that looks > at only the (e.g.) second plane. [...] To get an image of a single plane: vil_image_view<X> pl = vil_plane( im, plane_index ); Note that pl will share memory with image, and the pixels of pl may not be contiguous. Certainly will not be contiguous if im stores the planes/channels in an interleaved fashion. (I.e., RGBRGB instead of RRGGBB.) > And question (3), if I'd like to reorder the representation in memory of > (a possible subset of) the planes, say from BGRA to RGB, what do I have > to do so that (e.g.) myRgbView.top_left_ptr() will point to contiguous > memory? [...] To get a contiguous memory subset of the planes, you will have to deep copy. You can use vil_plane to make your life easier: vil_image_view<X> tgt(ni,nj,np,1); // for interleaved store // vil_image_view<X> tgt(ni,nj,1,np ); // for planar store for i = 1 to num planes to copy { vil_plane(tgt,i).deep_copy( vil_plane( src, map[i] ) ); } None of the snippets above have been compiler tested, let alone run, but it should get you started. Hope this helps. Amitha. |