Skip to content

Commit

Permalink
Added method for creating Gaussian illuminations
Browse files Browse the repository at this point in the history
  • Loading branch information
wandell committed Jul 28, 2020
1 parent 597a718 commit fa169a0
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 5 deletions.
6 changes: 5 additions & 1 deletion data/sensor/colorfilters/gaussianCreate.m
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
% s_createGaussianFilters

% Deprecated
%
% Create a set of filters for use in a simulated camera

% Gaussian type:
cfType = 'gaussian';
% isosbestic = [500,529,545,570,584];
% non-isosbestic = [517 560 577 595];

wavelength = [480:4:900]; cPos = [500, 529, 550, 560, 595]; width = [20,20,20,20,20];
data = sensorColorFilter(cfType,wavelength, cPos, width);

plot(wavelength,data);

filterNames = ['a', 'b', 'c', 'd', 'e'];
comment = 'Gaussian filters created by s_createGaussianFilters';
cd 'C:\Users\joyce\Documents\Matlab\SVN\iset-4.0\data\sensor\colorfilters';
Expand Down
29 changes: 28 additions & 1 deletion scene/illumination/illuminantCreate.m
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
% Create an ISETCam illuminant (light source) structure.
%
% Synopsis:
% illuminantCreate(ilName, wave, varargin)
% il = illuminantCreate(ilName, wave, varargin)
%
% Brief description:
% The illuminant structure includes information about the SPD of the
Expand Down Expand Up @@ -53,13 +53,22 @@
il = illuminantCreate('illuminant c',wave);
plotRadiance(wave,illuminantGet(il,'photons'));
%}
%{
wave = 400:3:700;
params.center = 510; params.sd = 5; params.peakEnergy = 10;
il = illuminantCreate('gaussian',wave,params);
wave = illuminantGet(il,'wave');
e = illuminantGet(il,'energy');
plotRadiance(wave,e)
%}

%% Initialize parameters
if ieNotDefined('ilName'), ilName = 'd65'; end
if ieNotDefined('wave'), wave = 400:10:700; end

il.name = ilName;
il.type = 'illuminant';
il.spectrum.wave = wave;

%% There is no default
% The absence of a default could be a problem.
Expand Down Expand Up @@ -92,6 +101,24 @@

il = illuminantSet(il,'name',sprintf('blackbody-%.0f',illP.temperature));

case 'gaussian'
% illuminantCreate('gaussian',wave,params)
% params.center(), params.sd(), params.peakEnergy
center = 550; % nm
sd = 20; % nm
peakEnergy = 25; % watts/sr/nm/m2
if ~isempty(varargin)
params = varargin{1};
% Person sent in parameters
if isfield(params,'center'), center = params.center; end
if isfield(params,'sd'), sd = params.sd; end
if isfield(params,'peakEnergy'), peakEnergy = params.peakEnergy; end
end

il = illuminantSet(il,'name',sprintf('Gaussian %.0f\n',center));
iEnergy = peakEnergy * exp(-1/2* ((wave - center)/sd).^2); % [W/(sr m^2 nm)]
iPhotons = Energy2Quanta(wave,iEnergy(:));

otherwise
error('unknown illuminant type %s\n',ilName);
end
Expand Down
6 changes: 5 additions & 1 deletion utility/plots/plotGaussianSpectrum.m
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
function tran=plotGaussianSpectrum(wavelength,mu,sig)

% Deprecated
%
%
% Plots a transmittance curve
% Used primarily by the makeCustomCFApattern UI

Expand All @@ -13,6 +15,7 @@
plot(wavelength,tran,'k');
axis tight
hold on;

% Load LUT that maps spectral wavelengths to visible colors
load spectrumLUT
% bbI 1x1377 11016 double
Expand All @@ -34,3 +37,4 @@
set(gca,'Xtick',[],'Ytick',[]);


end
4 changes: 2 additions & 2 deletions utility/plots/sensorPlot.m
Original file line number Diff line number Diff line change
Expand Up @@ -227,8 +227,8 @@
else, rect = sensor.roi;
end

% Make sure the sensor window is selected
sensorImageWindow;
% Make sure the sensor window is selected with the sensor data
sensorImageWindow();
g = rectangle('Position',rect,'EdgeColor','w','LineWidth',2);
uData.rect = rect;
case {'chromaticity'}
Expand Down

0 comments on commit fa169a0

Please sign in to comment.