00001
00002
00003
#ifndef GUARD_HISTOGRAM_H
00004
#define GUARD_HISTOGRAM_H
00005
00006
#include <vector>
00007
#include <map>
00008
#include <sstream>
00009
using namespace std;
00010
00011
#include "Debug.hpp"
00012
#include "Pixel.hpp"
00013
#include "Color.hpp"
00014
00015
static Channel channelHistogram(&cout);
00016
00017
00018
00019
00020
00021 class HistogramClass{
00022
00023 Color color;
00024
00025 vector<Pixel>
data;
00026
00027 int total;
00028
public:
00029
00030
HistogramClass(
Color);
00031
00032 string
toString()const;
00033
00034
void addPixel(
Pixel);
00035
00036
int getSize()const;
00037
00038
void setTotal(
int);
00039
00040
int getTotal()const;
00041
00042 Pixel getElementAt(const
int)const;
00043 };
00044
00045
00046
00047
00048
00049 class
Histogram{
00050
00051 int pixelNumber;
00052
00053 map<Color, HistogramClass> data;
00054
00055 typedef map<Color, HistogramClass>::iterator map_iter;
00056
00057 typedef map<Color, HistogramClass>::const_iterator const_map_iter;
00058 vector<Color> classColor;
00059
public:
00060
00061 Histogram(): pixelNumber(0){}
00062
00063 string
toString()const;
00064
00065
void addPixel(Pixel);
00066
00067
void makeCumul();
00068
00069
void makeClass(
int classNumber);
00070
00071 Pixel getElementAt(const
int) const;
00072
00073 int getSize()
const {
return data.size();}
00074
00075
Color getColor(
int) const;
00076 };
00077 #endif