Lennart Heimbs 5 years ago
parent
commit
15f46de0a3

+ 0
- 7
camera/video_presence.py View File

now = '' now = ''
framecounter = 0 framecounter = 0
trackeron = 0 trackeron = 0
people_count_total = 0

cv2.namedWindow('Video stream', cv2.WINDOW_NORMAL)
if VISUAL_DEBUG:
cv2.namedWindow('debug image', cv2.WINDOW_NORMAL)


while True: while True:
if VISUAL_DEBUG:
print("Frame {}".format(framecounter))
people_count_per_frame = 0 people_count_per_frame = 0
frame = vs.read() frame = vs.read()
frame = frame if args.get("video", None) is None else frame[1] frame = frame if args.get("video", None) is None else frame[1]

+ 2
- 2
camera/video_stream/imagezmq.py View File

connect_to: the tcp address:port of the hub computer. connect_to: the tcp address:port of the hub computer.
""" """


def __init__(self, connect_to='tcp://127.0.0.1:5555'):
def __init__(self, connect_to='tcp://127.0.0.1:63128'):
"""Initializes zmq socket for sending images to the hub. """Initializes zmq socket for sending images to the hub.


Expects an open socket at the connect_to tcp address; it will Expects an open socket at the connect_to tcp address; it will
open_port: (optional) the socket to open for receiving REQ requests. open_port: (optional) the socket to open for receiving REQ requests.
""" """


def __init__(self, open_port='tcp://*:5555'):
def __init__(self, open_port='tcp://*:63128'):
"""Initializes zmq REP socket to receive images and text. """Initializes zmq REP socket to receive images and text.
""" """



+ 1
- 1
camera/video_stream/zmq_video_client.py View File

# initialize the ImageSender object with the socket address of the # initialize the ImageSender object with the socket address of the
# server # server
sender = imagezmq.ImageSender(connect_to="tcp://{}:5555".format(
sender = imagezmq.ImageSender(connect_to="tcp://{}:63128".format(
args["server_ip"])) args["server_ip"]))
rpi_name = socket.gethostname() # send RPi hostname with each image rpi_name = socket.gethostname() # send RPi hostname with each image

+ 5
- 2
camera/video_stream/zmq_video_client_file.py View File

args["server_ip"])) args["server_ip"]))


rpi_name = socket.gethostname() # send RPi hostname with each image rpi_name = socket.gethostname() # send RPi hostname with each image
video_file = FileVideoStream("../run.mp4").start()
video_file = FileVideoStream("run.mp4").start()
time.sleep(2.0) # allow camera sensor to warm up time.sleep(2.0) # allow camera sensor to warm up
while video_file.more():

while True:
image = video_file.read() image = video_file.read()
if image is None:
break
sender.send_image(rpi_name, image) sender.send_image(rpi_name, image)

Loading…
Cancel
Save