3.4 camera -- Interface for taking photographs and video recording

Availability: S60.

The camera module enables taking photographs and video recording.

The following data items for state information are available in camera:

EOpenComplete
The opening of the video clip has succeeded.

ERecordComplete
The video recording has completed (not called on explicit stop_recording call).

EPrepareComplete
The device is ready to begin video recording.

The camera module has the following functions3.3:

cameras_available( )
Returns the number of cameras available in the device.

image_modes( )
Returns the image modes supported in the device as a list of strings, for example: ['RGB12', 'RGB', 'JPEG_Exif', 'RGB16'].

image_sizes( )
Returns the image sizes (resolution) supported in the device as a list of (x, y) tuples, for example: [(640, 480), (160, 120)].

flash_modes( )
Returns the flash modes available in the device as a list of strings.

max_zoom( )
Returns the maximum digital zoom value supported in the device as an integer.

exposure_modes( )
Returns the exposure settings supported in the device as a list of strings.

white_balance_modes( )
Returns the white balance modes available in the device as a list of strings.

take_photo( [mode, size, zoom, flash, exposure, white_balance, position])
Takes a photograph and returns the image in:

  1. Image format (for more information on Image format, see Chapter 3.3 graphics Module) or

  2. Raw JPEG data3.4.

The settings listed below describe all settings that are supported by the camera module. You can retrieve the mode settings available for your device by using the appropriate functions listed at the beginning of this chapter.

If some other application is using the camera, this operation fails, with error SymbianError: KErrInUse. Invoking this function right after the device boot, might result in SymbianError: KErrNotReady error.

In some Nokia devices (e.g. in N95), to be able to get the highest possible size for the captured image, you need to:

  1. switch to the landscape mode (see appuifw.app.orientation)
  2. import the camera module
  3. take the picture in the 'JPEG_Exif' format.

start_finder( callable[, backlight_on=1, size=main_pane_size])

Starts the camera viewfinder and binds a callback to receive Image format feed. When a new viewfinder frame is ready the callback is invoked with the Image as parameter.

The optional parameter backlight_on determines whether the device backlight is kept on when the camera view finder is in operation. By default, the backlight is on (1 = on, 0 = off).

The optional parameter size (of type tuple, e.g. (176, 144)) can be used to change the size of the Image received in the callback. The default size is the same as the application's main pane size.

Example view finder code:

>>> import appuifw
>>> import camera
>>> def cb(im):
...   appuifw.app.body.blit(im)
...
>>> import graphics
>>> appuifw.app.body=appuifw.Canvas()
>>> camera.start_finder(cb)
>>>

stop_finder( )
Stops the viewfinder.

release( )
Releases the camera - After invocation other applications can access the camera hardware.

start_record( filename, callable)
Starts video recording. filename is the file where the video clip is saved and callable will be called with possible error code (int) and status information (see data in module camera) as parameter.

Prior calling this function, the view finder needs to be started.

stop_record( )
Stops the video recording.



Footnotes

... functions3.3
Descriptions for some of the values are based on information found in S60 SDK documentation [4]
... data3.4
For more information, see e.g. http://en.wikipedia.org/wiki/JPEG.
See About this document... for information on suggesting changes.