Illustration of pixel size (sensor spatial resolution) and aliasing

A sweep frequency scene is imaged through the optics to form an irradiance image. That image is then measured by a monochrome sensor with a coarse pixel and then with a fine pixel. The consequences of pixel size appear

Contents

```ieInit
```

Create a scene with a simple test pattern and put it in the scene window

```scene = sceneCreate('sweepFrequency');

% You can set the field of view in a variety of ways to alter the spatial
% scale of the optical image
scene = sceneSet(scene,'fov',1);
```

Create an optical image and put it in the optical image window

```oi = oiCreate;
oi = oiSet(oi,'optics fnumber',4);
oi = oiSet(oi,'optics focal Length',0.004);

oi = oiCompute(scene,oi);
```

Create a monochrome sensor, and compute the voltage response

```sensor = sensorCreate('monochrome');
sensor = sensorCompute(sensor,oi);

% To see the sensor image in a GUI, use this

% Now plot the optical image and the voltage response on a common spatial
% scale. First, generate a plot of the voltage across the pixels on the
% sensor, saving the data in sData.  Choose the middle row.
row = sensorGet(sensor,'rows'); row = round(row/2);
[g, sData] = sensorPlotLine(sensor,'h','volts','space',[1,row]);
close(g);
```

Generate the optical image plot for illuminance

```row   = sceneGet(oi,'rows'); row = round(row/2);
[oData,g] = oiPlot(oi,'horizontal line illuminance',[1,row]);
close(g);

% One set of data is in volts and the other in illuminance.  Normalize them
% to a common 0,1 range
sData.normData = ieScale(sData.data,0,1);
oData.normData = ieScale(oData.data,0,1);

% Now plot the two curves on the same spatial scale, remembering that the
% pixel position is in the middle.  That is why we take away 1/2 of the
% pixel width from the pixel position
% Plot the varying portion
vcNewGraphWin;
pSize = sensorGet(sensor,'pixel width','microns');
plot(sData.pos - pSize/2,sData.normData,'-o', ...
oData.pos-1,oData.normData,'-x')
set(gca,'xlim',[-40 40])
xSpacing = 10*pSize;
xtick = min(sData.pos):xSpacing:max(sData.pos);
set(gca,'xtick',xtick); grid on; title('Coarse pixel')

% Notice the spatial aliasing at the high frequencies.
```

Create a monochrome sensor with smaller pixels

```% Compute the voltage response ;
sensorSmall = sensorSet(sensor,'pixel size Constant Fill Factor',[1,1]*2e-6);
sensorSmall = sensorCompute(sensorSmall,oi);

% To see the sensor image in a GUI, use this
```

Same plotting as above, note the end of the aliasing

```row = sensorGet(sensorSmall,'rows'); row = round(row/2);

[g, sData] = sensorPlotLine(sensorSmall,'h','volts','space',[1,row]);
close(g);

row = sceneGet(oi,'rows'); row = round(row/2);

[oData,g] = oiPlot(oi,'horizontallineilluminance',[1,row]); close(g);
sData.normData = ieScale(sData.data,0,1);
oData.normData = ieScale(oData.data,0,1);
pSize = sensorGet(sensorSmall,'pixel width','microns');

vcNewGraphWin;
plot(sData.pos - pSize/2,sData.normData,'-o', ...
oData.pos-1,oData.normData,'-x')
set(gca,'xlim',[-40 40])
xtick = min(sData.pos):xSpacing:max(sData.pos);
set(gca,'xtick',xtick); grid on; title('Fine pixel')
```