diff --git a/src/trace/siox.h b/src/trace/siox.h
index 0dbf76a8e0e187b8ea28bc0c5e49b70535519595..5d6059d3ce84c3dabb5eccb437b491ef97130e24 100644 (file)
--- a/src/trace/siox.h
+++ b/src/trace/siox.h
/**
*
*/
-class CLAB
+class CieLab
{
public:
/**
*
*/
- CLAB()
+ CieLab()
{
+ init();
C = 0;
L = A = B = 0.0f;
}
/**
*
*/
- CLAB(unsigned long rgb);
+ CieLab(unsigned long rgb);
/**
*
*/
- CLAB(float lArg, float aArg, float bArg)
+ CieLab(float lArg, float aArg, float bArg)
{
+ init();
C = 0;
L = lArg;
A = aArg;
/**
*
*/
- CLAB(const CLAB &other)
+ CieLab(const CieLab &other)
{
+ init();
C = other.C;
L = other.L;
A = other.A;
/**
*
*/
- CLAB &operator=(const CLAB &other)
+ CieLab &operator=(const CieLab &other)
{
+ init();
C = other.C;
L = other.L;
A = other.A;
/**
*
*/
- virtual ~CLAB()
+ virtual ~CieLab()
{}
/**
- * Retrieve a CLAB value via index.
+ * Retrieve a CieLab value via index.
*/
virtual float operator()(unsigned int index)
{
/**
*
*/
- virtual void add(const CLAB &other)
+ virtual void add(const CieLab &other)
{
C += other.C;
L += other.L;
virtual unsigned long toRGB();
/**
- * Computes squared euclidian distance in CLAB space for two colors
+ * Approximate cube roots
+ */
+ double cbrt(double x);
+
+ /**
+ *
+ */
+ double qnrt(double x);
+
+ /**
+ * Raise to the 2.4 power
+ */
+ double pow24(double x);
+
+ /**
+ * Squared Euclidian distance between this and another color
+ */
+ float diffSq(const CieLab &other);
+
+ /**
+ * Computes squared euclidian distance in CieLab space for two colors
* given as RGB values.
*/
static float diffSq(unsigned int rgb1, unsigned int rgb2);
/**
- * Computes squared euclidian distance in CLAB space for two colors
+ * Computes squared euclidian distance in CieLab space for two colors
* given as RGB values.
*/
static float diff(unsigned int rgb0, unsigned int rgb1);
float A;
float B;
+private:
+
+ /**
+ *
+ */
+ void init();
+
};
* Confidence matrix data
*/
float *cmdata;
+
+private:
+
+ /**
+ * Error logging
+ */
+ void error(char *fmt, ...) G_GNUC_PRINTF(2,3);
+
};
/**
* Error logging
*/
- void error(char *fmt, ...);
+ void error(char *fmt, ...) G_GNUC_PRINTF(2,3);
/**
* Trace logging
*/
- void trace(char *fmt, ...);
+ void trace(char *fmt, ...) G_GNUC_PRINTF(2,3);
/**
* Stage 1 of the color signature work. 'dims' will be either
* 2 for grays, or 3 for colors
*/
- void colorSignatureStage1(CLAB *points,
+ void colorSignatureStage1(CieLab *points,
unsigned int leftBase,
unsigned int rightBase,
unsigned int recursionDepth,
/**
* Stage 2 of the color signature work
*/
- void colorSignatureStage2(CLAB *points,
+ void colorSignatureStage2(CieLab *points,
unsigned int leftBase,
unsigned int rightBase,
unsigned int recursionDepth,
/**
* Main color signature method
*/
- bool colorSignature(const std::vector<CLAB> &inputVec,
- std::vector<CLAB> &result,
+ bool colorSignature(const std::vector<CieLab> &inputVec,
+ std::vector<CieLab> &result,
const unsigned int dims);
*/
float sqrEuclidianDist(float *p, int pSize, float *q);
- /**
- * Squared Euclidian distance of p and q.
- */
- float sqrEuclidianDist(const CLAB &p, const CLAB &q);
+
};