00001 #ifndef vil_binary_dilate_h_
00002 #define vil_binary_dilate_h_
00003
00004
00005
00006
00007
00008 #include <vil/algo/vil_structuring_element.h>
00009 #include <vil/vil_image_view.h>
00010 #include <vil/vil_border.h>
00011
00012
00013 inline bool vil_binary_dilate(const bool* im, const vcl_ptrdiff_t* offset, unsigned n)
00014 {
00015 for (unsigned i=0;i<n;++i) if (im[offset[i]]) return true;
00016 return false;
00017 }
00018
00019
00020
00021 template <class imAccessorT>
00022 inline bool vil_binary_dilate(const imAccessorT& image, unsigned plane,
00023 const vil_structuring_element& element, int i0, int j0)
00024 {
00025 unsigned n = element.p_i().size();
00026 for (unsigned int k=0;k<n;++k)
00027 {
00028 unsigned int i = i0+element.p_i()[k];
00029 unsigned int j = j0+element.p_j()[k];
00030 if (image(i,j,plane))
00031 return true;
00032 }
00033 return false;
00034 }
00035
00036
00037
00038
00039 void vil_binary_dilate(const vil_image_view<bool>& src_image,
00040 vil_image_view<bool>& dest_image,
00041 const vil_structuring_element& element);
00042
00043
00044
00045
00046
00047 void vil_binary_dilate(const vil_image_view<bool>& src_image,
00048 vil_image_view<bool>& dest_image,
00049 const vil_structuring_element& element,
00050 const vil_border<vil_image_view<bool> >& border);
00051
00052 #endif // vil_binary_dilate_h_