Xasan
•
Senior Member
•
Posts: 1,092
Re: Xrite Color Profiles ?
1
Jack Hogan wrote:
https://www.strollswithmydog.com/open-raspberry-pi-high-quality-camera-raw/
Hi, Jack,
A few questions and comments on your code to estimate an FM matrix, https://www.strollswithmydog.com/wordpress/wp-content/uploads/estimateMatrix_.zip
1. With the normalization you have
raw = raw ./ raw(22,:) * xyzRef(22,2);
the following comment:
% raw 24x3, 0->1, white balanced raw RGB values from the CC24 capture
(in case it's about the input parameter) can be reduced to
% raw 24x3, raw RGB values from the CC24 capture
because neither the range, nor WB seem to matter, your normalization take care of those things.
2. This expression, raw = raw ./ raw(22,:) * xyzRef(22,2);
may change the source raw data, I would write it like
raw_norm = raw ./ raw(22,:) * xyzRef(22,2);
3. M0 = pinv(raw' * raw) * raw' * xyzRef;
As far as I remember linalg, M'*M is square, symmetric, and invertible, inv should be OK. It doesn't matter for matlab, but if one is re-coding to C or something, inv may be easier.
4. With pinv,
M0 = pinv(raw) * xyzRef;
should work equally well?
5. With Octave 6.3.0 and calling your code like this:
load matlab.mat
[M,avgDE,k,output] = estimateMatrix(raw,xyzn,xyzRef);
disp('Results:')
disp('FM = '); disp(M)
disp(['avgDE = ' num2str(avgDE)])
disp(['k = ' num2str(k)])
disp(output)
disp('Done')
the output is:
-- hide signature --
Results:
FM =
0.633138 0.372352 -0.050895
0.212305 1.125705 -0.338010
0.028222 -0.211492 1.072867
avgDE = 1.4869
k = 1.0106
scalar structure containing the fields:
iterations = 1324
funcCount = 1967
algorithm = Nelder-Mead simplex direct search
message = Algorithm converged. Simplex size 8.9483e-05 <= 1.0000e-04 and step in function value 2.3702e-07 <= 1.0000e-04
------------------
FM differs from what you have here:

It's fairly normal, as the implementation of fmin is different?