11 std::vector<double>& histo)
14 std::fill(histo.begin(),histo.end(),0.0);
16 unsigned ni = image.
ni(),nj = image.
nj(),np = image.
nplanes();
19 for (
unsigned p=0;p<np;++p,plane += pstep)
21 const vxl_byte* row = plane;
22 for (
unsigned j=0;j<nj;++j,row += jstep)
24 const vxl_byte* pixel = row;
25 for (
unsigned i=0;i<ni;++i,pixel+=istep) histo[*pixel]+=1;
Concrete view of image data of type T held in memory.
std::ptrdiff_t jstep() const
Add this to your pixel pointer to get next j pixel.
unsigned ni() const
Width.
unsigned nj() const
Height.
std::ptrdiff_t planestep() const
Add this to your pixel pointer to get pixel on next plane.
T * top_left_ptr()
Pointer to the first (top left in plane 0) pixel.
unsigned nplanes() const
Number of planes.
void vil_histogram_byte(const vil_image_view< vxl_byte > &image, std::vector< double > &histo)
Construct histogram from pixels in given image of bytes.
Construct histogram from pixels in given image.
std::ptrdiff_t istep() const
Add this to your pixel pointer to get next i pixel.