×
Namespaces

Variants
Actions

Archived:Take a photo at regular intervals using PySymbian

From Nokia Developer Wiki
Jump to: navigation, search

Archived.pngAquivado: Este artigo foi arquivado, pois o conteúdo não é mais considerado relevante para se criar soluções comerciais atuais. Se você achar que este artigo ainda é importante, inclua o template {{ForArchiveReview|escreva a sua justificativa}}.

All PySymbian articles have been archived. PySymbian is no longer maintained by Nokia and is not guaranteed to work on more recent Symbian devices. It is not possible to submit apps to Nokia Store.

Article Metadata
Article
Created: cyke64 (02 Oct 2007)
Last edited: hamishwillee (14 Jun 2013)

Here is a code that will help to take photos from a camera at regular intervals.This interval can be set as required by the developer.

import e32, camera
 
path = "c:\\tmp.jpg"
 
def capture():
img = camera.take_photo()
img.save( path )
 
d = 0
 
while True:
print "Wait"
e32.ao_sleep(3)
capture()
print "Photo %d saved\n" %(d)
d+=1
 
print "Session Ended"

The loop in the code is a forever loop.This loop can be modified according to the condition required by the developer. The above code clicks a new image from the camera at a regular interval of 3 seconds. This interval can also be modified by changing the argument in the statement

e32.ao_sleep(3)  Which is a delay introduced.

Also It can be observed that the images are saved with the same name with the above code.

Also provision can be made to save the images with different name.There are several formats for naming.

One such format is to save the image with the date in the file name.The following code an be used for the same.

from time import ctime
 
your_path="C:\\image "
def capture():
img = camera.take_photo()
img.save( your_path + ctime + ".jpg")
#this saves the picture in jpg format with a date in the filename

Both the codes can be appropriately combined to have the required code to capture photos from the camera at regular intervals and to save them to a desired location with the desired different file name.

This page was last modified on 14 June 2013, at 08:11.
52 page views in the last 30 days.
×