14 # include <vcl_msvc_warnings.h> 19 std::cerr <<
"vil_math_median is currently not implemented for this data type\n";
26 unsigned ni = im.
ni();
27 unsigned nj = im.
nj();
35 unsigned hist[256] = { 0 };
36 for (
unsigned j=0;j<nj;++j) {
37 for (
unsigned i=0;i<ni;++i) {
44 unsigned tgt = (tot+1) / 2;
53 if ( cnt == tgt && tot % 2 == 0 ) {
56 while ( hist[idx] == 0 ) {
59 median = vxl_byte((lo+idx)/2);
62 median = vxl_byte(idx-1);
Various mathematical manipulations of 2D images.
Concrete view of image data of type T held in memory.
unsigned ni() const
Width.
unsigned nj() const
Height.
void vil_math_median(imT &median, const vil_image_view< imT > &im, unsigned p)
Median of elements in plane p of an image.
void vil_math_median_unimplemented()