[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: playground/graphics/tamponi/painterlyframework/utilities/src/ipg
From: Emanuele Tamponi <emanuele () valinor ! it>
Date: 2007-11-30 23:55:48
Message-ID: 1196466948.332178.13960.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 743449 by tamponi:
Another little step to the new mixer: initial implementation of the new
ProfileGenerator. I hope to get it finished for tomorrow. An important
idea on this side: this relies on the Chromatic Adaptation algorithm used
while converting a sRGB color to a generic Reflectance rappresentation
for a certain illuminant. The algorithm I use is that of Bradford, but
I recently (today...) noticed that there are some free patents about
chromatic adaptation and it should be good to both consider them and write
the ProfileGenerator in a adaptation-algorithm-indipendent way.
Goodnight!
D Makefile
D ipg.pro
M +43 -3 profile_generator.cpp
M +9 -5 profile_generator.h
--- trunk/playground/graphics/tamponi/painterlyframework/utilities/src/ipg/profile_generator.cpp \
#743448:743449 @@ -2,14 +2,54 @@
#include "profile_generator.h"
+#include <cstring>
+
+#include "function.h"
+
#include <QString>
#include <QVector>
-#include "function.h"
+#include <gsl/gsl_blas.h>
+#include <gsl/gsl_matrix.h>
+#include <gsl/gsl_vector.h>
-ProfileGenerator::ProfileGenerator(unsigned int num, const Function &hFunct)
- : m_num(num), m_hFunct(hFunct)
+ProfileGenerator::ProfileGenerator(unsigned int N, const Function &H)
+ : m_N(N), m_H(H)
{
+ // 1- Load CMFs
+ // 2- Generate GQ for each CMF*m_hFunct
+ // 3- Build the H matrix
+ // 4- Build Chromaticity Adaptation matrix
+ // 5- Build R as M^-1 * A^-1 * H
+ // 6- Order wavelenghts
+ // 7- Save matrix and wavelenght order ( in save() )
+
+ // 1
+ Function x("resources/CMFs/2deg_x.txt");
+ Function y("resources/CMFs/2deg_y.txt");
+ Function z("resources/CMFs/2deg_z.txt");
+
+ // 2
+ GaussianQuadrature wx(N, x*H);
+ GaussianQuadrature wy(N, y*H);
+ GaussianQuadrature wz(N, z*H);
+
+ // 3
+ m_T = gsl_matrix_alloc(3, 3*N);
+ gsl_matrix_set_zero(m_T);
+
+ double k = 0;
+ for (int j = 0; j < N; j++)
+ k += wy.weights()[j];
+ for (int j = 0; j < N; j++) {
+ gsl_matrix_set(m_T, 0, 0*N, wx.weights()[j]);
+ gsl_matrix_set(m_T, 1, 1*N, wy.weights()[j]);
+ gsl_matrix_set(m_T, 2, 2*N, wz.weights()[j]);
+ }
+ gsl_matrix_scale(m_T, 1.0/k);
+
+ // 4
+
}
ProfileGenerator::~ProfileGenerator()
--- trunk/playground/graphics/tamponi/painterlyframework/utilities/src/ipg/profile_generator.h \
#743448:743449 @@ -3,24 +3,28 @@
#ifndef PROFILE_GENERATOR_H_
#define PROFILE_GENERATOR_H_
-#include <QVector>
#include "function.h"
+#include <QVector>
+
+#include <gsl/gsl_matrix.h>
+
class Function;
class QString;
class ProfileGenerator {
public:
- ProfileGenerator(unsigned int num, const Function &hFunct);
+ ProfileGenerator(unsigned int N, const Function &H);
~ProfileGenerator();
bool save(const QString &filename);
private:
- unsigned int m_num;
- Function m_hFunct;
- QVector<unsigned int> m_sortedWL;
+ unsigned int m_N; // TODO can we remove this?
+ Function m_H; // TODO can we remove this?
+ gsl_matrix *m_T; // Transformation matrix
+ QVector<unsigned int> m_sortedWL;
};
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic