Electronic Rolling Shutter

From ElphelWiki
Revision as of 16:47, 20 October 2016 by Oleg (talk | contribs) (ERS and GRR in MT9P001 on 10393)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Basics

Most CMOS image sensors (to save one transistor per cell compared to a true "snapshot" shutter) use Electronic Rolling Shutter. Basically it implements two pointers to sensor pixels, both proceeding in the same line-scan order across the sensor,

One is erase pointer, the other one - readout. Erase pointer runs ahead discharging each photosensitive cell, then follows the readout one. Each pixel sees (and accumulates) the light for the same exposure time (from the moment erase pointer passes it till it is read out), but that happens at different time.

If you will make an image of a fast passing car with ERS with short exposure - it will all be sharp (no blurring), but the car will seem to lean backwards. The roof will be captured at earlier time than the wheels and this time difference across the frame can be as long as 1/15 of a second for the full frame of the MT9P001 5MPix sensor (it is equal to the frame readout time that is equal to 1 sec divided by the frame rate in most circumstances).

Exposure control

Exposure in ERS mode is defined by the time delay between the erase and readout pointer and is usually programmed to the sensor as a number of scan lines between the two. For obvious reasons that time can not exceed the frame period, so the maximal exposure is achieved when each pixel is erased immediately after being readout, this exposure is equal to the frame period.

Virtual frame

Sometimes when the lighting conditions are poor even the full frame exposure is not enough, for that most sensors have means to increase the frame time. Different manufacturers call it differently, it is sometimes called "virtual frame" or horizontal and vertical blanking. With the virtual frame the readout timing is as if the sensor was much bigger than in reality and instead of nonexistent pixels zero values are fed to the output. But "as if" reading nonexistent pixels in each row (horizontal blanking) and rows of pixels (vertical blanking) takes the same time as real ones, it allows to extend frame readout and increase exposure time.

But even those "imaginative" frames are not infinite - different sensors have different bit widths of the corresponding counters, you can see them overflow in the Elphel cameras (with the current software) as a horizontal border in the image separating different brightness areas if exposure is too high (depending on the resolution/size it can be about a second).

Hardware "margins"

Total frame readout time can never be as small as the pixel readout time multiplied by the total number of pixels, all sensors (what I know of) need some extra time in each line and some extra time for each frame. You may consider it as a some kind of hardware margins (as those fro printers), and usually these margins are much bigger in horizontally than vertically. Practically that means that if you make sensor capture a narrow horizontal band you can get to much higher frame rate than if you try to cut vertical column. You may find particular calculations of the frame timing in the Aptina (Micron) MT9P001 sensor datasheet, linked here.

ERS-built CMOS sensors with "global" shutter

Some CMOS sensors have "global shutter" function mentioned in the specs but it is usually far from the real snapshot ones (as in the modern CCD-based camcorders). Such mode has simultaneous erase of all pixels, but the end of exposure is still determined by the it readout, so exposure time for each pixel will be different - pixels in the bottom of the frame will be exposed longer by the exposure time. Such mode is useful with the flash lamp, when it is triggered after all the pixels are erased but before the readout starts, but usually quite useless without such lamp (or external shutter of some kind - i.e. mechanical or LCD).

ERS and GRR in MT9P001 on 10393

Fig.1 ERS + external LED flash: flash duration = 5us, exposure = 4ms, external signal delay (LED flash) = 30ms
Fig.2 Global reset release shutter + external LED flash: flash duration = 5us, exposure = 1 line, external signal delay (LED flash) = 10ms

Setup a flash using the programmable output trigger signal for rolling and global reset release shutters

Electronic Rolling Shutter

Fig.3 Parameters, TRIG[4]==0

Example steps:

1. TRIG_PERIOD=25000000 (decimal,4FPS, 10ns steps)
   TRIG_DELAY=3000000 (10ns steps, for port 0 = output sync signal delay after the 1st line exposure start, for ports 1..3 - a delay from the port 0 1st line exposure start to other port's 1st line exposure)
   EXTERN_TIMESTAMP=0x0 (not using external timestamp)
   TRIG_BITLENGTH=0xff (max output signal width is 5us, 20ns steps when XMIT_TIMESTAMP=0)
   TRIG_CONDITION=0x0 (internal source for trigger)
   TRIG_OUT=0x66555 (enables output trigger signal)

2. TRIG=0x4
3. Change any parameters from 1.

Global Reset Release shutter

Fig.4 Parameters, TRIG[4]==1

Example steps:

1. TRIG_PERIOD=25000000 (decimal,4FPS, 10ns steps)
   TRIG_DELAY=1000000 (10ns steps, for port 0 = output sync signal delay after the 1st line exposure start, for ports 1..3 - a delay from the port 0 1st line exposure start to other port's 1st line exposure)
   EXTERN_TIMESTAMP=0x0 (not using external timestamp)
   TRIG_BITLENGTH=0xff (max output signal width is 5us, 20ns steps when XMIT_TIMESTAMP=0)
   TRIG_CONDITION=0x0 (internal source for trigger)
   TRIG_OUT=0x66555

2. TRIG=0x14
3. Change any parameters from 1.