Commit af7a861a authored by gabriel falcones's avatar gabriel falcones

work in python2 and python3

parent e0133948
......@@ -5,16 +5,19 @@ import threading
import time
import sys
from datetime import datetime
from Queue import Queue, Empty
try:
from Queue import Queue, Empty
except ModuleNotFoundError as e:
print("python3")
from queue import Queue, Empty
raw_input = input
import grpc
from FeatureExtractionApi_pb2 import Image
import FeatureExtractionApi_pb2_grpc
import cv2
#from picamera import PiCamera
#from picamera.exc import PiCameraMMALError, PiCameraError
from datetime import datetime
FPS = 15
SERVER_URL = '200.126.23.95:50052'
SERVER_URL = '127.0.0.1:50052'
"""
resultados: grabando 60s a res 640x480
Tiempo adicional que tarda en terminar de enviar todos los frames capturados
......@@ -58,9 +61,6 @@ class VideoRecorder:
self.image_queue.put(Image(source=bytesImg,file_name=filename,timestamp=str(datetime.now())))
if self.recording_stop:
break
# time.sleep(0.09)#~10.18 secs
# time.sleep(0.18)# ~ 5.3 secs
# time.sleep(0.05) # ~ 16.6 secs
if cv2.waitKey(1) & 0xFF == ord('q'):
break
# print self.count
......@@ -74,7 +74,7 @@ class VideoRecorder:
try:
yield self.image_queue.get(block=True, timeout=1)
self.image_queue.task_done()
print "sent",self.sent_count, "of", self.count, "captured"
print ("sent",self.sent_count, "of", self.count, "captured")
self.sent_count += 1
except Empty as ex:
print ("No data in image queue")
......@@ -144,8 +144,8 @@ if __name__ == "__main__":
print(start)
vid_recorder.record("test")
print("*Recording")
#raw_input()
time.sleep(60)
raw_input()
# time.sleep(4)
stop_recording = datetime.now()
recording_time = stop_recording - start
vid_recorder.stop_record()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment