context = zmq.Context(1)
socket = context.socket(zmq.REQ)
socket.bind("tcp://*:%s" % port)
p = Process(target=self.camera_process, args=(cam_name, port))
p.start()
pipeline = SettingsManager().cams[cam_name]["pipelines"]["pipeline0"]
while True:
# start = time.time(
_, image = cv_sink.grabFrame(image)
socket.send_pyobj({'image': image,
'pipeline': pipeline})
# end = time.time()
image = socket.recv_pyobj()
以及另一台机器
context = zmq.Context(1)
socket = context.socket(zmq.REP)
socket.connect("tcp://localhost:%s" % port)
while True:
obj = socket.recv_pyobj()
image = obj['image']
# curr_pipeline = obj["pipeline"]
# hsv_image = self._hsv_threshold(curr_pipeline["hue"],
# curr_pipeline["saturation"], curr_pipeline["value"],
# image, curr_pipeline["erode"], curr_pipeline["dilate"])
# contours = self.find_contours(hsv_image)
# filtered_contours = self.filter_contours(contours, cam_area, curr_pipeline["area"], curr_pipeline["ratio"],
# curr_pipeline["extent"])
# res = self.draw_image(input_image=image, is_binary=False, rectangles=filtered_contours)
socket.send_pyobj(image)
一些libs arent“直接”打开opencv,但是我得到的图像是开放的cv格式图像,而我试图做的是在另一台机器上处理当前所有图像处理都被有意关闭的情况,并且仍然我有这个奇怪的滞后link to a video with the lag。谢谢你的帮助