Go to the documentation of this file.00001 #ifndef vil_binary_erode_h_
00002 #define vil_binary_erode_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_erode(const bool* im, const vcl_ptrdiff_t* offset, unsigned n)
00014 {
00015 for (unsigned i=0;i<n;++i) if (!im[offset[i]]) return false;
00016 return true;
00017 }
00018
00019
00020
00021
00022 template <class imAccessorT>
00023 inline bool vil_binary_erode(const imAccessorT& image, unsigned plane,
00024 const vil_structuring_element& element, int i0, int j0)
00025 {
00026 unsigned n = element.p_i().size();
00027 for (unsigned int k=0;k<n;++k)
00028 {
00029 unsigned int i = i0+element.p_i()[k];
00030 unsigned int j = j0+element.p_j()[k];
00031 if (!image(i,j,plane))
00032 return false;
00033 }
00034 return true;
00035 }
00036
00037
00038
00039
00040 void vil_binary_erode(const vil_image_view<bool>& src_image,
00041 vil_image_view<bool>& dest_image,
00042 const vil_structuring_element& element);
00043
00044
00045
00046
00047
00048 void vil_binary_erode(const vil_image_view<bool>& src_image,
00049 vil_image_view<bool>& dest_image,
00050 const vil_structuring_element& element,
00051 const vil_border<vil_image_view<bool> >& border);
00052
00053 #endif // vil_binary_erode_h_