scene = sceneCreate('star pattern',iSize,'ee',nLines);
scene = sceneSet(scene,'fov',fov);
% Create a sensor whose field of view matches the scene size
pixelSize = [1.4 1.4]*1e-6; % Pixel size of 1.4 um
sensor = sensorSet(sensor,'pixel size constant fill factor',pixelSize);
sensor = sensorSet(sensor,'fov',sceneGet(scene,'fov')/2,oi);
sz = sensorGet(sensor,'size');
% Exposure time of the complete image (all rows). As we increase the
% exposure time, the rotating line turns into a wedge. The width of the
% wedge increases with exposure time.
expTime = 1e-4; % Millisecond regime
sensor = sensorSet(sensor,'exp time',expTime);
% Read out time per row (should be microsecond range).
% The delay between reading the first and last row is
% perRow * (number of rows)
% At the end of this routine, we assemble the final image by assuming that
% the reset time is delayed in the same way that the read out time is
% delayed. This gives every row the same exposure duration, but the
% acquisition period of each of the rows is delayed in time.
% To see a bigger effect of the rolling shutter, make this number bigger.
% How many total captures do we need? Number of rows plus enough additional
nFrames = sz(1) + round(expTime/perRow);
% Store the sensor volts from each capture separately, before we assemble.
v = zeros(sz(1),sz(2),nFrames);
% The number of degrees the rays rotate between each row capture (perRow).
% The deg per second is rate/perRow or in total rotations per second
% rate/perRow/360. The faster the rotation, the more the curvature.
fprintf('Computing %i frames\nRotation rate: %.2f (cycles per sec)\n',nFrames,rate/perRow/360);
Computing 70 frames
Rotation rate: 83.33 (cycles per sec)
w = waitbar(0,'Rotating scenes');
S = 160; % This is the size of the cropped oi
waitbar(ii/nFrames,w,sprintf('Scene %i',ii));
% Rotation shrink the image at the boundary by adding in zero values
% where there is an unknown extrapolation. We remove this by the
s = sceneRotate(scene,deg);
% ieAddObject(s); sceneWindow;
% Compute and crop to keep just the center
cp = oiGet(oi,'center pixel');
rect = round([cp(1) - S/2, cp(2) - S/2, S, S]);
% ieAddObject(oiC); oiWindow;
sensor = sensorCompute(sensor,oiC);
% After first capture, set noise to photon only
sensor = sensorSet(sensor,'noise flag',1);
v(:,:,ii) = sensorGet(sensor,'volts');
% This is the final, summed voltages for each row.
% Each row is read out for some proportion of the capture.
% This is the list of sensor rows that are read out from each image.
% we will add these in to the final image.
slist = 1:round(expTime/perRow);
% Sum across a sliding temporal range
ieFigure; colormap(gray(64)); axis image; axis off
tmp = squeeze(v(rr,:,:));
imagesc(final); pause(1/fps);