def set_photo_cb(): def save_hook(f): config.set("photo","flash",int(f[0][2][1])) config.set("photo","zoom",int(f[1][2])) config.set("photo","exposure",int(f[2][2][1])) config.set("photo","balance",int(f[3][2][1])) config.set("photo","resolution",int(f[4][2][1])) config.save() return True flash_modes = [] for x in camera.flash_modes(): flash_modes.append(x.decode()) exposure_modes = [] for x in camera.exposure_modes(): exposure_modes.append(x.decode()) balance_modes = [] for x in camera.white_balance_modes(): balance_modes.append(x.decode()) image_sizes = [] for x in camera.image_sizes(): image_sizes.append(u"%sx%s" % x) flash = config.get("photo","flash",0) zoom = config.get("photo","zoom",0) exposure = config.get("photo","exposure",0) balance = config.get("photo","balance",0) resolution = config.get("photo","resolution",0) fields = [(_("M_flash"),"combo",(flash_modes,flash)),(_("M_zoom"),"number",zoom), (_("M_exposure"),"combo",(exposure_modes,exposure)), (_("M_balance"),"combo",(balance_modes,balance)), (_("M_resolution"),"combo",(image_sizes,resolution))] form = appuifw.Form(fields) form.save_hook = save_hook form.execute()
def take_photo(self): try: img = camera.take_photo(size = camera.image_sizes()[self.setup['image_size']], flash = camera.flash_modes()[self.setup['flash_mode']], exposure = camera.exposure_modes()[self.setup['exp_mode']], white_balance = camera.white_balance_modes()[self.setup['white_mode']]) self.filename = time.strftime("%Y%m%d_%H%M%S", time.localtime()) + ".jpg" self.filename = os.path.join(DEFDIR, "images", self.filename) img.save(self.filename) except: note(LABELS.loc.pt_err_cant_take_pic,"error") self.cancel_app() return self.taken = True
def take_photo(desired_size, position = 0): global last_photo img = last_photo if img == None: flash = camera.flash_modes()[config.get("photo","flash",0)] zoom = config.get("photo","zoom",0) exposure = camera.exposure_modes()[config.get("photo","exposure",0)] balance = camera.white_balance_modes()[config.get("photo","balance",0)] resolution = camera.image_sizes()[config.get("photo","resolution",0)] img = camera.take_photo(mode="RGB", size=resolution, flash=flash, zoom=zoom, exposure=exposure, white_balance=balance, position=position) last_photo = img if img.size > desired_size: img = img.resize(desired_size,keepaspect=1) img.text((10,img.size[1]-25),get_datetime_str(),font=u"LatinBold19",fill=(255,255,0)) return img
import appuifw appuifw.app.orientation='landscape' # must be called before importing camera appuifw.app.screen='full' from key_codes import * import e32, time, camera, globalui, graphics # variables used for mode change messages info = u"" start_time = 0 # supportet modes flash_modes = camera.flash_modes() exposure_modes = camera.exposure_modes() white_modes = camera.white_balance_modes() # default mode values if 'forced' in flash_modes: flash_mode = flash_modes.index('forced') else: flash_mode = 0 exposure_mode = 0 white_mode = 0 # applicaton lock app_lock = e32.Ao_lock() # exit function def quit():
def test_exposure_modes(self): self._test_util('exposure_modes', camera.exposure_modes())
# 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')
def exp_mode_menu(self): res = popup_menu([unicode(x) for x in camera.exposure_modes()],LABELS.loc.pt_pmenu_expos) if res is not None: self.setup['exp_mode'] = res
# 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" picture = camera.take_photo(mode='RGB') picture.save(u'high.jpg') print "high res file written"
def __init__(self): self.image_mode=camera.image_modes() self.image_size=camera.image_sizes() self.flash_mode=camera.flash_modes() self.exp_mode=camera.exposure_modes() self.wbalance=camera.white_balance_modes()