def index(): print('test') if request.method == 'POST': result = capture_image() else: result = None return render_template('view.html', result=result)
def captureimage(): img = capture.capture_image() cv2.imwrite("facedetected.png", img) photo = PhotoImage(file='facedetected.png') canvas.delete("all") canvas2 = canvas.create_image(1, 1, anchor=NW, image=photo) canvas.itemconfig(canvas1, image=canvas2) canvas.pack() leftframe.pack(side=LEFT) root.mainloop()
def image(update, context): #image = open('image.jpg', 'rb') logging.info('take picture') image = capture_image() if image is None: context.bot.send_message(chat_id=update.effective_chat.id, text="ERROR") else: caption = datetime.now().strftime("%Y-%m-%d %H:%M:%S") context.bot.send_photo(chat_id=update.effective_chat.id, photo=image, caption=caption)
from capture import capture_image print(capture_image())
try: sleep(1) except IOError as err: if err.errno != errno.EINTR: raise s = ser.read(1) client.info('get ' + s) if s != 'D': if s == '': client.info('no signal ...') else: client.info('get wrong signal, continue...') continue capture.capture_image() reco_ret = recognition.recognition_person(client, authdata_database, authdata_dataname) if "unknown" == reco_ret: ser.write('F\n') client.info("warning, unknown person\n") client.info('uploading file ... ') file_name = os.path.abspath('.') + '/' + \ capture.unknown_path + '/' + capture.image_name upload_file_prefix = time.strftime("%Y_%m_%d_%H_%M_%S") upload_file_name = upload_file_prefix + '.jpg' client.info(file_name + ' ' + upload_file_name) result = client.file_upload(\ file_name, \
def save_image(): the_update = str(capture_image())
pnconfig = PNConfiguration() pnconfig.publish_key = "pub-c-10b9f92d-a0e2-4d07-bef2-8b84aee0c2a3" pnconfig.subscribe_key = "sub-c-12ea3aa6-ed25-11ea-a728-4ec3aefbf636" pnconfig.uuid = "serverUUID-PUB" pubnub = PubNub(pnconfig) # s = "" # with open("Found.jpg", "rb") as image: # s = str(base64.b64encode(image.read())) # print(s) def save_image(): the_update = str(capture_image()) while 1: the_update = str(capture_image()) the_message = {"name": "Raven", "message": the_update} envelope = pubnub.publish().channel(CHANNEL).message(the_message).sync() if envelope.status.is_error(): print("[PUBLISH: fail]") print("error: %s" % status.error) else: print("[PUBLISH: sent]") print("timetoken: %s" % envelope.result.timetoken)