Example #1
0
	def set_zoom_0():
		global zoom, z1, z2, z3
		zoom=0
		z1="X 0"
		z2=str(camera.max_zoom()/4)
		z3=str(camera.max_zoom()/2)
		pic=camera.take_photo('RGB', resolution, zoom)
		camera.stop_finder()
		camera.start_finder(vf, size=(240,180))
Example #2
0
 def set_zoom_quarter_max():
     global zoom, z1, z2, z3
     zoom = camera.max_zoom() / 4
     z1 = "0"
     z2 = "X " + str(camera.max_zoom() / 4)
     z3 = str(camera.max_zoom() / 2)
     pic = camera.take_photo('RGB', resolution, zoom)
     camera.stop_finder()
     camera.start_finder(vf, size=(240, 180))
Example #3
0
 def set_zoom_0():
     global zoom, z1, z2, z3
     zoom = 0
     z1 = "X 0"
     z2 = "%s" % str(camera.max_zoom() / 4)
     z3 = "%s" % str(camera.max_zoom() / 2)
     pic = camera.take_photo('RGB', resolution, zoom)
     camera.stop_finder()
     camera.start_finder(vf, size=(240, 180))
Example #4
0
 def test_max_zoom(self):
     self._test_util('max_zoom', camera.max_zoom())
def photocamera():
    global keyboard, z1, z2, z3, zoom, r1, r2, resolution, q, q1, q2

    #We set the tabs of the application
    def handle_tabs(index):
        global lb, videocamera
        if index == 0: photocamera()
        if index == 1: videocamera()

    appuifw.app.set_tabs([u"Photo", u"Video"], handle_tabs)

    #In order to be able to take several pictures and videos, we add a number to the end of their filenames.
    #This number is obtained by checking how many files of that type are saved on the device
    i = len(os.listdir("E:\\Images\\"))
    photo_savepath = u"E:\\Images\\pic%d.jpg" % i

    #Make the background a canvas; needed for key capturing
    canvas = appuifw.Canvas(event_callback=keyboard.handle_event,
                            redraw_callback=None)
    appuifw.app.body = canvas

    #The default resolution is 0.8 megapixels and the default zoom level is 0
    resolution = (1024, 768)
    r1 = "X 1024x768"
    r2 = "640x480"
    zoom = 0
    z1 = "X 0"
    z2 = str(camera.max_zoom() / 4)
    z3 = str(camera.max_zoom() / 2)

    #These functions set the resolution, zoom and image quality to the selected value
    def set_res_vga():
        global resolution, r1, r2
        resolution = (640, 480)
        r1 = "1024x768"
        r2 = "X 640x480"

    def set_res_08():
        global resolution, r1, r2
        resolution = (1024, 768)
        r1 = "X 1024x768"
        r2 = "640x480"

    def set_zoom_0():
        global zoom, z1, z2, z3
        zoom = 0
        z1 = "X 0"
        z2 = str(camera.max_zoom() / 4)
        z3 = str(camera.max_zoom() / 2)
        pic = camera.take_photo('RGB', resolution, zoom)
        camera.stop_finder()
        camera.start_finder(vf, size=(240, 180))

    def set_zoom_quarter_max():
        global zoom, z1, z2, z3
        zoom = camera.max_zoom() / 4
        z1 = "0"
        z2 = "X " + str(camera.max_zoom() / 4)
        z3 = str(camera.max_zoom() / 2)
        pic = camera.take_photo('RGB', resolution, zoom)
        camera.stop_finder()
        camera.start_finder(vf, size=(240, 180))

    def set_zoom_half_max():
        global zoom, z1, z2, z3
        zoom = camera.max_zoom() / 2
        z1 = "0"
        z2 = str(camera.max_zoom() / 4)
        z3 = "X " + str(camera.max_zoom() / 2)
        pic = camera.take_photo('RGB', resolution, zoom)
        camera.stop_finder()
        camera.start_finder(vf, size=(240, 180))

    def set_qual_50():
        global q, q1, q2
        q = 50
        q1 = "High"
        q2 = "X Low"

    def set_qual_100():
        global q, q1, q2
        q = 100
        q1 = "X High"
        q2 = "Low"

    #In order for the viewfinder to correspond to the zoom level, we must take a picture (without saving it), close and open the viewfinder
    #These steps are necessary because of the way the functions are currently defined in PyS60, and have a slight impact on performance
    #Future releases of PyS60 may have optimized functions
    pic = camera.take_photo('RGB', resolution, zoom)
    camera.stop_finder()
    camera.start_finder(vf, size=(240, 180))

    #We now create a loop that "waits" for keys to be pressed
    running = True
    while running:
        if keyboard.pressed(EScancodeSelect):
            pic = camera.take_photo('RGB', resolution, zoom)  #Take the picture
            pic.save(photo_savepath, quality=q)  #Save it
            photocamera()  #Restart camera in photo mode
        if keyboard.pressed(EScancodeRightSoftkey): quit()
        appuifw.app.menu = [(u"Zoom", ((u"%s" % z1, set_zoom_0),
                                       (u"%s" % z2, set_zoom_quarter_max),
                                       (u"%s" % z3, set_zoom_half_max))),
                            (u"Resolution", ((u"%s" % r1, set_res_08),
                                             (u"%s" % r2, set_res_vga))),
                            (u"Quality", ((u"%s" % q1, set_qual_100),
                                          (u"%s" % q2, set_qual_50))),
                            (u"Exit", quit)]
        e32.ao_yield()
Example #6
0
# Sasank Reddy
# [email protected]
# -------------------

# This program is designed to get a sample of sound data from the phone.
# Then the program will get the power value from the sample.  Finally, this information
# will be logged to SensorBase.

import appuifw, e32, sys, os, struct, math, audio, time, sysinfo, urllib, httplib, thread, camera, graphics

#photoCaptured = camera.take_photo('RGB', (1280, 960), 'auto', 1, 'auto', 'auto', 0)
photoCaptured = camera.take_photo('RGB', (1280, 960), 0, 'auto', 'auto',
                                  'auto', 0)

print camera.image_modes()
print camera.image_sizes()
print camera.flash_modes()
print camera.max_zoom()
print camera.exposure_modes()
print camera.white_balance_modes()
#photoCaptured = camera.take_photo()

photoName = unicode("E:\\Others\\")
photoName += unicode(time.strftime("%Y-%m-%d %H-%M-%S", time.localtime()))
photoName += unicode(".jpg")
photoCaptured.save(photoName, None, 'JPEG', 100, 24, 'no')
Example #7
0
# Sasank Reddy
# [email protected]
# -------------------

# This program is designed to get a sample of sound data from the phone.
# Then the program will get the power value from the sample.  Finally, this information
# will be logged to SensorBase.

import appuifw, e32, sys, os, struct, math, audio, time, sysinfo, urllib, httplib, thread, camera, graphics

#photoCaptured = camera.take_photo('RGB', (1280, 960), 'auto', 1, 'auto', 'auto', 0)
photoCaptured = camera.take_photo('RGB', (1280, 960), 0, 'auto', 'auto', 'auto', 0)

print camera.image_modes()
print camera.image_sizes()
print camera.flash_modes()
print camera.max_zoom()
print camera.exposure_modes()
print camera.white_balance_modes() 
#photoCaptured = camera.take_photo()

photoName = unicode("E:\\Others\\")
photoName += unicode(time.strftime("%Y-%m-%d %H-%M-%S", time.localtime()))
photoName += unicode(".jpg")
photoCaptured.save(photoName, None, 'JPEG', 100, 24, 'no')

Example #8
0
def photocamera():
	global keyboard, z1, z2, z3, zoom, r1, r2, resolution, q, q1, q2
 
	#We set the tabs of the application
	def handle_tabs(index):
		global lb, videocamera
		if index==0:photocamera()
		if index==1:videocamera()
	appuifw.app.set_tabs([u"Photo", u"Video"], handle_tabs)
 
	#In order to be able to take several pictures and videos, we add a number to the end of their filenames.
	#This number is obtained by checking how many files of that type are saved on the device
	i=len(os.listdir("E:\\Images\\"))
	photo_savepath=u"E:\\Images\\pic%d.jpg" % i
 
	#Make the background a canvas; needed for key capturing
	canvas=appuifw.Canvas(event_callback=keyboard.handle_event, redraw_callback=None)
	appuifw.app.body=canvas
 
	#The default resolution is 0.8 megapixels and the default zoom level is 0
	resolution=(1024, 768)
	r1="X 1024x768"
	r2="640x480"
	zoom=0
	z1="X 0"
	z2=str(camera.max_zoom()/4)
	z3=str(camera.max_zoom()/2)
 
	#These functions set the resolution, zoom and image quality to the selected value
	def set_res_vga():
		global resolution, r1, r2
		resolution=(640, 480)
		r1="1024x768"
		r2="X 640x480"
	def set_res_08():
		global resolution, r1, r2
		resolution=(1024, 768)
		r1="X 1024x768"
		r2="640x480"
 
	def set_zoom_0():
		global zoom, z1, z2, z3
		zoom=0
		z1="X 0"
		z2=str(camera.max_zoom()/4)
		z3=str(camera.max_zoom()/2)
		pic=camera.take_photo('RGB', resolution, zoom)
		camera.stop_finder()
		camera.start_finder(vf, size=(240,180))
	def set_zoom_quarter_max():
		global zoom, z1, z2, z3
		zoom=camera.max_zoom()/4
		z1="0"
		z2="X " + str(camera.max_zoom()/4)
		z3=str(camera.max_zoom()/2)
		pic=camera.take_photo('RGB', resolution, zoom)
		camera.stop_finder()
		camera.start_finder(vf, size=(240,180))
	def set_zoom_half_max():
		global zoom, z1, z2, z3
		zoom=camera.max_zoom()/2
		z1="0"
		z2=str(camera.max_zoom()/4)
		z3="X " + str(camera.max_zoom()/2)
		pic=camera.take_photo('RGB', resolution, zoom)
		camera.stop_finder()
		camera.start_finder(vf, size=(240,180))
 
	def set_qual_50():
		global q, q1, q2
		q=50
		q1="High"
		q2="X Low"
	def set_qual_100():
		global q, q1, q2
		q=100
		q1="X High"
		q2="Low"
 
	#In order for the viewfinder to correspond to the zoom level, we must take a picture (without saving it), close and open the viewfinder
	#These steps are necessary because of the way the functions are currently defined in PyS60, and have a slight impact on performance
	#Future releases of PyS60 may have optimized functions
	pic=camera.take_photo('RGB', resolution, zoom)
	camera.stop_finder()
	camera.start_finder(vf, size=(240,180))
 
	#We now create a loop that "waits" for keys to be pressed
	running=True
	while running:
		if keyboard.pressed(EScancodeSelect):
			pic=camera.take_photo('RGB', resolution, zoom)  #Take the picture
			pic.save(photo_savepath, quality=q)             #Save it
			photocamera()                                   #Restart camera in photo mode
		if keyboard.pressed(EScancodeRightSoftkey):quit()
		appuifw.app.menu=[(u"Zoom", ((u"%s" % z1, set_zoom_0), (u"%s" % z2, set_zoom_quarter_max), (u"%s" % z3, set_zoom_half_max))), (u"Resolution", ((u"%s" % r1, set_res_08), (u"%s" % r2, set_res_vga))), (u"Quality", ((u"%s" % q1, set_qual_100), (u"%s" % q2, set_qual_50))), (u"Exit", quit)]
		e32.ao_yield()
Example #9
0
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

#
# test_camera.py
#

import camera
import e32

print "Dir camera: ", dir(camera)

maxZoom = camera.max_zoom()
print "Max zoom: ", maxZoom
flash = camera.flash_modes()
print "Flash modes: ", flash
exp = camera.exposure_modes()
print "Exp modes: ", exp
white = camera.white_balance_modes()
print "White modes: ", white

picture = camera.take_photo(mode='RGB12')
picture.save(u'low.jpg')
print "low res file written"

picture = camera.take_photo(mode='RGB16')
picture.save(u'middle.jpg')
print "middle res file written"