48 #ifndef _MIRA_COLORMAP_H_ 49 #define _MIRA_COLORMAP_H_ 72 virtual std::size_t size()
const = 0;
77 virtual Color::RGB get(std::size_t idx)
const = 0;
109 mColormap(colormap), mPosition(position) {}
114 mColormap(other.mColormap), mPosition(other.mPosition) {}
145 return mColormap==other.mColormap && mPosition==other.mPosition;
156 assert(mColormap!=NULL);
157 mCache = mColormap->get(mPosition);
163 assert(mColormap!=NULL);
164 mCache = mColormap->get(mPosition);
170 std::size_t mPosition;
226 void resize(std::size_t pSize) {mSize=pSize;}
229 virtual std::size_t
size()
const {
return mSize;}
233 return getf((
float)idx / (
float)size());}
265 void setColorAt(
float position,
const Color::RGB& color);
268 setColorAt(position,
Color::RGB(r/255.0f,g/255.0f,b/255.0f));
276 std::map<float, Color::RGB> mColorKeys;
316 mRFormula(7),mGFormula(5),mBFormula(15) {}
326 void setFormulae(
int rformula,
int gformula,
int bformula);
329 int mRFormula, mGFormula, mBFormula;
366 setFormulae(rformula, gformula, bformula);
396 mData(pData), mSize(pSize) {}
398 virtual std::size_t
size()
const {
return mSize;}
402 (
float)mData[idx*3+1]/255.0f,
403 (
float)mData[idx*3+2]/255.0f);
520 float alpha = (f-0.375f)*4.0f;
524 return Color::RGB(1.0f,1.0f-(f-0.625f)*4.0f,0.0f);
526 return Color::RGB(1.0f-(f-0.875f)*4,0.0f,0.0f);
589 const static uint8 colormap[3*10];
604 const static uint8 colormap[3*6];
iterator begin()
Gives an iterator to the beginning of the colormap.
Definition: Colormap.h:180
GradientColormap(std::size_t size=256)
Definition: Colormap.h:289
static Color::RGB sGetf(float f)
Definition: Colormap.h:424
base class for discrete color colormaps
Definition: Colormap.h:195
virtual std::size_t size() const
Returns the set size.
Definition: Colormap.h:229
A continuous HSV colormap.
Definition: Colormap.h:446
A continuous Red-Blue colormap.
Definition: Colormap.h:543
GrayscaleColormap(std::size_t size=256)
Definition: Colormap.h:422
iterator & operator--()
go to previous color
Definition: Colormap.h:132
static Color::RGB sGetf(float f)
Definition: Colormap.h:453
const_iterator end() const
Gives an const iterator to the end of the colormap.
Definition: Colormap.h:189
void setColorAt(float position, const Color::RGB &color)
Sets a color key at the given position with the given color.
Definition: Colormap.h:295
Internal base class for linear gradient color maps.
Definition: Colormap.h:251
pointer operator->() const
Dereference to the color, the iterator is pointing to.
Definition: Colormap.h:162
static Color::RGB sGetf(float f)
Definition: Colormap.h:502
iterator const_iterator
Definition: Colormap.h:175
specialize cv::DataType for our ImgPixel and inherit from cv::DataType<Vec>
Definition: IOService.h:67
const_iterator begin() const
Gives a const iterator to the beginning of the colormap.
Definition: Colormap.h:183
const Color::RGB & reference
Definition: Colormap.h:103
void setColorAt(float position, const Color::RGB &color)
Sets a color key at the given position with the given color.
iterator end()
Gives an iterator to the end of the colormap.
Definition: Colormap.h:186
Base class for continuous color colormaps.
Definition: Colormap.h:217
Base class for tabular color colormaps.
Definition: Colormap.h:385
The default pm3d gnuplot palette (black-blue-red-yellow)
Definition: Colormap.h:571
virtual Color::RGB getf(float f) const
Accesses the continuous colors.
Definition: Colormap.h:560
int difference_type
Definition: Colormap.h:100
A discrete colormap with 6 complementary colors.
Definition: Colormap.h:598
GradientColormapBase(std::size_t size)
Definition: Colormap.h:255
#define MIRA_ABSTRACT_OBJECT(classIdentifier)
Use this MACRO instead of MIRA_OBJECT to declare the class as abstract.
Definition: FactoryMacros.h:235
void clear()
Removes all color keys.
virtual Color::RGB getf(float f) const
Accesses the continuous colors.
Definition: Colormap.h:434
std::bidirectional_iterator_tag iterator_category
Definition: Colormap.h:104
$Header file containing base classes to enable class creation using a class factory$ ...
const Color::RGB * pointer
Definition: Colormap.h:102
ContinuousColormap(std::size_t size=256)
Definition: Colormap.h:221
HSVColormap(std::size_t size=256)
Definition: Colormap.h:451
Color::RGB operator()(std::size_t idx)
Returns the color in the colormap at the given index.
Definition: Colormap.h:82
The object class acts as a generic base class for classes which should be used with the classFactory...
Definition: Object.h:144
Color::RGB value_type
Definition: Colormap.h:99
virtual Color::RGB getf(float f) const
Accesses the continuous colors.
Definition: Colormap.h:483
void resize(std::size_t pSize)
Sets a certain size of this colormap.
Definition: Colormap.h:226
bool operator==(const ImgIteratorBase &a, const ImgIteratorBase &b)
Definition: ImgIterator.h:225
JetColormap(std::size_t size=256)
Definition: Colormap.h:500
bool operator==(const iterator &other)
Definition: Colormap.h:144
RedBlueColormap(std::size_t size=256)
Definition: Colormap.h:547
#define MIRA_OBJECT(classIdentifier)
Use this MACRO if you like the factory to automatically extract the class name from the given identif...
Definition: FactoryMacros.h:179
void setColorAt(float position, int r, int g, int b)
Definition: Colormap.h:267
reference operator*() const
Dereference to the color, the iterator is pointing to.
Definition: Colormap.h:155
iterator()
Definition: Colormap.h:112
This file contains color classes for the Img class.
#define MIRA_NO_PUBLIC_DEFAULT_CONSTRUCTOR(CLASS)
Use this macro if your class does not have a public default constructor and should be managed by the ...
Definition: FactoryMacros.h:270
A discrete colormap with 10 complementary colors.
Definition: Colormap.h:583
Color::RGB operator[](std::size_t idx)
Returns the color in the colormap at the given index.
Definition: Colormap.h:87
void clear()
Removes all color keys.
Definition: Colormap.h:300
Complementary10Colormap()
Definition: Colormap.h:587
class MIRA_BASE_EXPORT RGB
Definition: Color.h:65
A continuous Jet colormap.
Definition: Colormap.h:495
virtual std::size_t size() const
Returns the number of elements in the colormap.
Definition: Colormap.h:398
iterator & operator++()
advance the iterator
Definition: Colormap.h:119
Complementary6Colormap()
Definition: Colormap.h:602
bool operator!=(const iterator &other)
Definition: Colormap.h:148
TabularColormap(const uint8 *pData, std::size_t pSize)
Creates a new TabularColormap using the specified color table that is specified as first parameter...
Definition: Colormap.h:395
A continuous grayscale colormap.
Definition: Colormap.h:417
The different color spaces.
Definition: Color.h:104
static Color::RGB sGetf(float f)
Definition: Colormap.h:551
iterator(const iterator &other)
Definition: Colormap.h:113
Iterator that can iterate over the whole color colormap similar to STL iterators on containers...
Definition: Colormap.h:96
iterator operator++(int)
advance the iterator
Definition: Colormap.h:125
Base class for color colormaps.
Definition: Colormap.h:62
iterator(const Colormap *colormap, std::size_t position)
Definition: Colormap.h:108
A class for creating continuous color maps based on linear gradients between predefined points...
Definition: Colormap.h:285
virtual Color::RGB getf(float f) const
Accesses the continuous colors.
Definition: Colormap.h:531
iterator operator--(int)
go to previous color
Definition: Colormap.h:138