def camquit(): camera.stop_finder() camera.release() # get main menu back appuifw.app.menu = menu_list # clean all bindings canvas.bind(key_codes.EKeySelect, None)
def quit(): #Close the viewfinder #camera.stop_finder() #Release the camera so that other programs can use it camera.release() app_lock.signal() appuifw.app.orientation = 'portrait'
def quit(): global running running = 0 camera.stop_finder() #Close the viewfinder camera.release() #Release the camera so that other programs can use it app_lock.signal() appuifw.app.set_exit()
def quit(): global running running=0 camera.stop_finder() #Close the viewfinder camera.release() #Release the camera so that other programs can use it app_lock.signal() appuifw.app.set_exit()
def CaptureImage(): path = 'ImagesTaken' if not os.path.exists(path): os.makedirs(path) camera_port = 0 imgNameDigitized = os.path.join( path, datetime.datetime.now().strftime( format='%b-%d-%Y-%I-%M-%S-%p_DIGI.png')) imgNameColorized = os.path.join( path, datetime.datetime.now().strftime( format='%b-%d-%Y-%I-%M-%S-%p_COLOR.png')) # CAPTURE IMAGE camera = cv2.VideoCapture( camera_port) #, cv2.CAP_DSHOW removed because of ERROR time.sleep(0.1) return_value, img = camera.read() camera.release() cv2.imwrite(imgNameColorized, img) # BINARIZE IMAGE grayscaled = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY) binarizedImage = cv2.adaptiveThreshold(grayscaled, 255, cv2.ADAPTIVE_THRESH_GAUSSIAN_C, cv2.THRESH_BINARY, 115, 1) cv2.imwrite(imgNameDigitized, binarizedImage) return imgNameDigitized, imgNameColorized
def close(self, pos = (0, 0)): self.canvas.bind(key_codes.EButton1Down, None) appuifw.app.screen = 'normal' appuifw.app.orientation = 'portrait' camera.stop_finder() camera.release()
def run(self): Dialog.refresh(self) try: camera.start_finder(self.redraw) except: note(LABELS.loc.pt_err_cant_start_viewf,"error") return None while (not self.taken) and (not self.cancel): e32.ao_yield() try: camera.stop_finder() camera.release() except: note(LABELS.loc.pt_err_cant_stop_viewf,"error") return self.filename
def run(self): # setup screen appuifw.app.screen = 'large' appuifw.app.title = u'Magic Video' appuifw.app.exit_key_handler = self.stop appuifw.app.body = appuifw.Canvas(event_callback=self.event) appuifw.app.menu = [(u"Effortless (2x2)", lambda: self.new_game(4)), (u"Easy (3x3)", lambda: self.new_game(9)), (u"Medium (4x4)", lambda: self.new_game(16)), (u"Hard (5x5)", lambda: self.new_game(25)), (u"Impossible (6x6)", lambda: self.new_game(36)), (u"Help", self.help), (u"About Magic Video", self.about)] self.prerender_text() camera.start_finder(self.draw) # start camera self.lock = e32.Ao_lock() self.lock.wait() camera.stop_finder() camera.release()
appuifw.app.title = u'PyS60 ViewFinder' appuifw.app.body = appuifw.Canvas(redraw_callback=cnvCallback) start() fpc = 0 tm = t.time() fps = 0.0 sz = appuifw.app.body.size img = Image.new((sz[0], sz[1] * 0.75)) #img=Image.new((160,120)) textrect = img.measure_text(u'00', font='normal')[0] text_img = Image.new((textrect[2] - textrect[0], textrect[3] - textrect[1])) img2 = Image.new((sz[0], sz[1] * 0.75)) textrect2 = img.measure_text(u'Saving video ...', font='normal')[0] text_img2 = Image.new( (textrect2[2] - textrect2[0], textrect2[3] - textrect2[1])) print appuifw.available_fonts() print sz txt = u'' while (not end): if (len(stack) > 30): aImg = stack.pop() #if aImg!=None: # aImg.save(u'd:\\.jpg') e32.ao_yield() camera.release() print "exiting app" SCRIPT_LOCK.wait()
def quit(): camera.stop_finder() camera.release() app_lock.signal()
def quit(): camera.release() app_lock.signal() logging.debug("Program exits")