9 # include <vcl_msvc_warnings.h> 28 unsigned ni = src_image.
ni();
29 unsigned nj = src_image.
nj();
32 std::ptrdiff_t s_istep = src_image.
istep(), s_jstep = src_image.
jstep();
33 std::ptrdiff_t d_istep = dest_image.
istep(), d_jstep = dest_image.
jstep();
38 std::vector<std::ptrdiff_t> offset;
42 int ilo = -element.
min_i();
43 int ihi = ni-1-element.
max_i();
44 int jlo = -element.
min_j();
45 int jhi = nj-1-element.
max_j();
51 for (
int i=0;i<ilo;++i)
52 for (
unsigned int j=0;j<nj;++j)
55 for (
unsigned int i=ihi+1;i<ni;++i)
56 for (
unsigned int j=0;j<nj;++j)
59 for (
int i=ilo;i<=ihi;++i)
60 for (
int j=0;j<jlo;++j)
63 for (
int i=ilo;i<=ihi;++i)
64 for (
unsigned int j=jhi+1;j<nj;++j)
67 for (
int j=jlo;j<=jhi;++j)
69 const bool* src_p = src_row0 + j*s_jstep + ilo*s_istep;
70 bool* dest_p = dest_row0 + j*d_jstep + ilo * d_istep;
72 for (
int i=ilo;i<=ihi;++i,src_p+=s_istep,dest_p+=d_istep)
int max_i() const
Elements in box bounded by [min_i(),max_i()][min_j(),max_j()].
Structuring element for morphology represented as a list of non-zero pixels.
int max_j() const
Elements in box bounded by [min_i(),max_i()][min_j(),max_j()].
void set_size(unsigned ni, unsigned nj) override
resize current planes to ni x nj.
Border class. Makes pixel access outside image range transparent and configurable.
bool vil_binary_dilate(const imAccessorT &image, unsigned plane, const vil_structuring_element &element, int i0, int j0)
Return true if any image pixel under element centred at (i0,j0) is non-zero.
std::ptrdiff_t jstep() const
Add this to your pixel pointer to get next j pixel.
unsigned ni() const
Width.
unsigned nj() const
Height.
Provides a pixel accessor which is syntax-compatible with vil_image_view.
void vil_compute_offsets(std::vector< std::ptrdiff_t > &offset, const vil_structuring_element &element, std::ptrdiff_t istep, std::ptrdiff_t jstep)
Generate a list of offsets for use on image with istep,jstep.
int min_j() const
Elements in box bounded by [min_i(),max_i()][min_j(),max_j()].
T * top_left_ptr()
Pointer to the first (top left in plane 0) pixel.
vil_border_accessor< imT > vil_border_create_accessor(const imT &im, const vil_border< imT > &border)
Instantiates a border accessor, provided for convenience.
unsigned nplanes() const
Number of planes.
vil_border< imT > vil_border_create_constant(const imT &, typename imT::pixel_type constant_val=0)
Instantiate a constant border whose type is derived from imT.
int min_i() const
Elements in box bounded by [min_i(),max_i()][min_j(),max_j()].
std::ptrdiff_t istep() const
Add this to your pixel pointer to get next i pixel.
Perform binary dilation on images.