refinery
RAW file processor
|
Says, for each color, how many of a picture's pixels hold each value. More...
#include <refinery/histogram.h>
Public Types | |
typedef ImageType::ValueType | ValueType |
Value type of each pixel color, for instance "unsigned short". | |
typedef ImageType::PixelType | PixelType |
Pixel type, for instance RGBPixel<unsigned char>. | |
typedef ImageType::ColorType | ColorType |
Color type, that is, index type. | |
Public Member Functions | |
Histogram (const ImageType &image) | |
Constructor. | |
unsigned int | nSlots () const |
Number of distinct counting slots. | |
unsigned int | nPixels () const |
Number of pixels in the original image. | |
unsigned short | count (const ColorType &color, std::size_t slot) const |
Number of pixels in a particular slot. | |
Static Public Attributes | |
static const unsigned int | Coarseness = TCoarseness |
Coarseness. | |
static const ColorType | NColors = PixelType::NColors |
Number of colors per pixel. |
Says, for each color, how many of a picture's pixels hold each value.
The TCoarseness parameter decides to what extent pixels will be "grouped" into histogram slots. For example, a Coarseness of 3 on an unsigned short value means the histogram will have 2^13 slots, rather than 2^16 (because 16 - 3 = 13). The first green slot in the histogram will sum the number of pixels with green values from 0 to 7 (7 = 2^3 - 1). A TCoarseness of 0 makes for an exact (but sometimes slower or less handy) histogram.
ImageType | Image instance. |
TCoarseness | Shrinking option. For 16-bit Image, 3 is nice. |
Definition at line 24 of file histogram.h.
typedef ImageType::ColorType refinery::Histogram< ImageType, TCoarseness >::ColorType |
Color type, that is, index type.
Definition at line 31 of file histogram.h.
typedef ImageType::PixelType refinery::Histogram< ImageType, TCoarseness >::PixelType |
Pixel type, for instance RGBPixel<unsigned char>.
Definition at line 29 of file histogram.h.
typedef ImageType::ValueType refinery::Histogram< ImageType, TCoarseness >::ValueType |
Value type of each pixel color, for instance "unsigned short".
Definition at line 27 of file histogram.h.
refinery::Histogram< ImageType, TCoarseness >::Histogram | ( | const ImageType & | image | ) | [inline] |
Constructor.
Once the Image has been read, it is forgotten.
Definition at line 73 of file histogram.h.
unsigned short refinery::Histogram< ImageType, TCoarseness >::count | ( | const ColorType & | color, |
std::size_t | slot | ||
) | const [inline] |
Number of pixels in a particular slot.
This is indexed by slot, not by pixel value.
color | Color. |
slot | Slot, from 0 to nSlots()-1. |
Definition at line 107 of file histogram.h.
unsigned int refinery::Histogram< ImageType, TCoarseness >::nPixels | ( | ) | const [inline] |
Number of pixels in the original image.
This is useful in case we want to show, for instance, what percentage of an image's pixels fall above or below a certain threshold.
Definition at line 96 of file histogram.h.
unsigned int refinery::Histogram< ImageType, TCoarseness >::nSlots | ( | ) | const [inline] |
Number of distinct counting slots.
For instance, if we're using a char-based ImageType and Coarseness is 0, nSlots() will return 256. If Coarseness is 1, it'll be 128; 2, 64; etc.
Definition at line 86 of file histogram.h.
const unsigned int refinery::Histogram< ImageType, TCoarseness >::Coarseness = TCoarseness [static] |
Coarseness.
Definition at line 33 of file histogram.h.
const ColorType refinery::Histogram< ImageType, TCoarseness >::NColors = PixelType::NColors [static] |
Number of colors per pixel.
Definition at line 35 of file histogram.h.