|
Camera API Technical Report:
A Camera Model |
A digital camera samples light intensity over a physical area and produces an array of numbers. The physical area is discretised into a 2-D rectangular array which is mapped onto the output array by windowing and scaling. The digital values corresponding to the light intensity are modified by binning (summation of adjacent values, a transfer function (LUT), by the exposure which is an integer multiple of some time quantum and possibly by shade correction and a calibration function. The output from the camera is a series of numbers with a number of bits-per-pixel determined by the original bits-per-pixel and the transfer LUT. The data-rate may be settable.
To the program the camera appears as an input device with settable and read-only attributes. Typically the read-only attributes correspond to limits and constraints on the settable values. Some constraints may only be available as functions with the general model: request a value (a window) get back the nearest allowed window. The attributes can be considered as read-only (RO) or read-write (RW), my suggested minimum set is below. Many of these are encoded within the camera functions rather than the device driver.
I can think of two types of camera distinguished by whether the image is stored or not. We can refer to these as DMA or Frame-Buffer cameras. In some sense the frame-buffer camera is more general because it can mimic the DMA type - by setting ``autocapture''. All our cameras and frame-grabbers fit this model, the Sun VideoPix board is something of a hybrid but must be thought of as a DMA type - data is read from a single address which is internally incremented after each short word is read.
The videopix raises the problem of colour, the model proposed here is a purely monochrome camera. Extension to colour shouldn't be difficult but I'll leave it for another day.
| Attribute | I/O | Comments |
| name | RO | camera name |
| type | RO | camera type if name is insufficient |
| init_str | RO | string passed to the camera initialisation procedure |
| file descriptor | RO | device file descriptor for cases when access beyond the camera model is required |
| frame buffer | RO | the frame buffer pointer for direct access |
The Spatial transform attributes are then:
| Attribute | I/O | Comments |
| horizontal size | RO | Horizontal sampling point separation |
| vertical size | RO | Vertical sampling point separation |
| size units | RO | units (microns) of the pixel size |
| window limits | RO | maximum size of the capture window in pixels, note a window comprises four numbers, a top-left corner with either a bottom-right or width-height pair |
| binning options | RO | a list of permitted binning values |
| sampling options | RO | a list of permitted sampling values |
| bin value | RW | the current binning value |
| sampling value | RW | the current sampling value |
| window | RW | the current window |
| image domain | RW | the current output image domain |
I suggest that we adopt a fixed and simple relationship between the
window and image domain coordinates namely:
| Attribute | I/O | Comments |
| pixel depth | RO | input pixel depth: bits-per-pixel |
| gain options | RO | list of input gains available - this is gain in the amplifier before digitisation |
| input gain | RW | current input gain |
| image depths | RO | list of output pixel depth options |
| output depth | RW | bits-per-pixel of the output image |
| transfer LUT | RW | transfer LUT of length
byte or short. |
| Attribute | I/O | Comments |
| exposure units | RO | time units ms |
| exposure limits | RO | limits on the settable exposure time (if any) |
| exposure | RW | current exposure time |
| Attribute | I/O | Comments |
| data rates | RO | data-rate options list |
| data rate | RW | current data rate |
| Attribute | I/O | Comments |
| video option | RO | is live video available |
| video overlay | RO | is a video display overlay available |
| video LUT size | RO | video output LUT - non zero if settable |
| live flag | RW | video live toggle |
| overlay flag | RW | overlay visibility toggle |
| overlay plane | RW | bitmask of overlay plane |
| overlay colour | RW | index of overlay colour |
| video LUT | RW | video output LUT |