From: Amitha Perera <AmithaPerera@us...>  20070215 16:23:11

On Tue 13 Feb 2007, Julio Pastrana wrote: > 1) bwarea(binaryimage) > Estimates the area of the "on" pixels of BW. vil_math_sum > 2)) Is there a function like the following one in octave: > > b = bwborder(binaryimage) %% where im is a binary matrix > b is the borders in the 01 matrix im. 4neighborhood is > considered. > A pixel is on the border if it is set in im, and it has at least > one neighbor that is not set. Repeated calls to vil_blob_finder::next_4con_region > 3) Can I do a XOR between 2 matrix. > > like in Octave I can do xor(A,B) where A and B are matrix Use a for loop. > 4) How can I use the VNL matrix operations with the vil_image types, is > there a wraper that cast my image matrix into a vnl_matrix (e.g) > > vil_image_view<float> to vnl_matrix<float> > > somthing like the "vil_convert_cast" but for VIL > VNL and > viceversa No easy way in general. If the images are contiguous, you could use a vnl_matrix_ref: assert( img.is_contiguous() && img.nplanes() == 1 ); vnl_matrix_ref<float> mat( img.nj(), img.ni(), img.top_left_ptr() ) > > 5) Convolution ( I already asked this question but no one answered ) > > How do I get rid of the border after a convolution > do I need to add some extra rows and colunms with zeros. > > I want a convolution that yileds on a matrix of the same size. The convolution in vil will not do the borders, because the kernel will not fit. If you want the borders done, you'll have to extend the source image as you want. Otherwise, put the dest image back into a properly sized image. vil_image_view<float> full_dest; vil_image_view<float> cropped_dest = vil_crop( full_dest, kernel.ni()/2, 1+src_im.ni()kernel.ni(), kernel.nj()/2, 1+src_im.nj()kernel.nj() ); cropped_dest.deep_copy( dest ); You may also be able to do the convolution directly into the crop (untested) vil_image_view<float> full_dest; vil_image_view<float> cropped_dest = vil_crop( full_dest, kernel.ni()/2, 1+src_im.ni()kernel.ni(), kernel.nj()/2, 1+src_im.nj()kernel.nj() ); vil_convole_2d( src, cropped_dest, kernel, double() ); Amitha. 