Home > ISET > vcamera > opticalImage > oiDiffuser.m

oiDiffuser

PURPOSE ^

Simulate blurring by a diffusing surface in the optical image path

SYNOPSIS ^

function [oi,sd,blurFilter] = oiDiffuser(oi,sd)

DESCRIPTION ^

Simulate blurring by a diffusing surface in the optical image path

   [oi,sd,blurFilter] = oiDiffuser(oi,sd)

 The blur is Gaussian, the same at all wavelengths.  The blur simulates
 the effects of a piece of glass that is commonly placed in front of the
 image sensor to prevent aliasing.  There are other interesting diffusers
 that will be simulated in the future.

 The sd can be 1 or 2D.  If it is 1D, the degree of blurring is specified
 as the standard deviation (sd) of a Gaussian (circularly symmetric, units
 of microns).  For example, if the sensor samples are spaced 4 um apart,
 then to reduce aliasing the standard deviation might be set to 2um.  

 If the sd is 2D, then we assume sd(1) = row spread and sd(2) is col
 spread.

 If no sd is specified, the sd size is set so that the blurring filter
 full width half max (FWHM) is one pixel width and circularly symmetric.  

 The blurFilter can be returned.  The sample spacing of the blur filter is
 equal to the sample spacing of the optical image in microns,
 oiGet(oi,'widthSpatialResolution','microns');

 Example
   oi = vcGetObject('oi');
   [oi,sd,blurFilter] = oiDiffuser(oi);
   name = oiGet(oi,'name');
   oi = oiSet(oi,'name',sprintf('%s-blur-%.0f',name,sd));
   vcAddAndSelectObject(oi); oiWindow;

   oi = oiCreate; scene = sceneCreate; scene = sceneSet(scene,'fov',1);
   oi = oiCompute(scene,oi); 
   % SD units are FWHM microns,
   [oi,sd,blurFilter] = oiDiffuser(oi,[10,2]);  
   [X,Y] = meshgrid(1:size(blurFilter,2),1:size(blurFilter,1));
   wSpatialRes = oiGet(oi,'widthSpatialResolution','microns');
   X = X*wSpatialRes;  Y = Y*wSpatialRes;
   X = X - mean(X(:)); Y = Y - mean(Y(:));
   figure(1); mesh(X,Y,blurFilter); 

 Copyright ImagEval Consultants, LLC, 2005.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:
Generated on Sun 14-Jan-2007 10:24:23 by m2html © 2003