1 #ifndef vil_greyscale_erode_h_ 2 #define vil_greyscale_erode_h_ 15 T min_v = im[offset[0]];
16 for (
unsigned i=1;i<n;++i)
17 if (im[offset[i]]<min_v) min_v=im[offset[i]];
32 unsigned n = element.
p_i().size();
33 for (
unsigned int k=0;k<n;++k)
35 unsigned int i = i0+element.
p_i()[k];
36 unsigned int j = j0+element.
p_j()[k];
37 if (i<image.
ni() && j<image.
nj())
39 if (first || image(i,j,plane) < min_v) {
40 min_v=image(i,j,plane); first=
false; }
56 #endif // vil_greyscale_erode_h_ Structuring element for morphology represented as a list of non-zero pixels.
const std::vector< int > & p_j() const
j position of elements (i,j).
Structuring element for morphology represented as a list of non-zero pixels.
Concrete view of image data of type T held in memory.
unsigned ni() const
Width.
unsigned nj() const
Height.
T vil_greyscale_erode(const vil_image_view< T > &image, unsigned plane, const vil_structuring_element &element, int i0, int j0)
Return max of pixels under structuring element centred at (i0,j0).
A base class reference-counting view of some image data.
const std::vector< int > & p_i() const
i position of elements (i,j).