File: GamutToSettingsSch.m

package info (click to toggle)
psychtoolbox-3 3.0.14.20170103%2Bgit6-g605ff5c.dfsg1-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 103,044 kB
  • ctags: 69,483
  • sloc: ansic: 167,371; cpp: 11,232; objc: 4,708; sh: 1,875; python: 383; php: 344; makefile: 207; java: 113
file content (36 lines) | stat: -rwxr-xr-x 1,376 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
function settings = GamutToSettingsSch(gammaInput, gammaTable, gamut)
% settings = GamutToSettingsSch(gammaInput, gammaTable, gamut)
%
% Find the best device settings to produce
% the passed linear device coordinates.
%
% This version works by linear interpolation on the fit values,
% with x as the output values and f(x) as the input values.
%  
% The passed coordinates should be in the range [0,1].
% The returned settings also run from [0,1], but after
% inversion of the device's gamma measurements.
%
% 9/26/93    dhb   Added calData argument.
% 10/19/93   dhb   Allow gamma table dimensions to exceed device settings.
% 11/11/93   dhb   Update for new calData routines.
% 8/4/96     dhb   Update for stuff bag routines.
%            dhb   Pulled out as a subroutine.
% 8/21/97	 dhb   Convert for structures.
% 11/16/06   dhb   Adjust for [0,1] world.
%            dhb   No more values return because we can't get at it in the [0,1] world
%            dhb   Pass input x values as well as y values.

% Check dimensions and table sizes
[m,n] = size(gamut);
[mg,ng] = size(gammaTable);
if (m > ng)
  error('Mismatch between device coordinate dimensions and gamma table');
end

% Use a search routine to find the best gamma function
settings = zeros(m,n);
% values = zeros(m,n);
for i = 1:m
  settings(i,:) = SearchGammaTable(gamut(i,:), gammaInput, gammaTable(:,i));
end