Пример #1
0
db = DataBase()
hand_detector = JsonReader('/home/algernon/PycharmProjects/test/origin_json')

current_time = format_time_from_str('7/1/2019 13:16:33')
work_places = initialize_work_places()

box_detector = Detector('boxes_detections.json')
part_detector = Detector('parts_detections.json')
while True:
    captured, frame = camera.read()
    if not captured:
        break

    hands_detections = hand_detector.read()
    box_detections = box_detector.get_detections_per_frame()
    part_detections = part_detector.get_detections_per_frame()

    for work_place in work_places:
        if work_place.next_pack_task_time and \
                current_time >= work_place.next_pack_task_time:
            cur_task, next_task_time = PackTask.get_pack_tasks(db, format_time_to_str(current_time),
                                                                        work_place.packer)
            work_place.set_cur_pack_task(cur_task)
            work_place.set_next_pack_task_time(format_time_from_str(next_task_time))
            work_place.reset_pack_task()

        # cv2.imshow(f'{work_place.packer}', work_place.get_work_place_view_from_frame(frame))
        # cv2.waitKey(1)
        frame = work_place.apply_tasks_on_frame(frame)
        if not work_place.pack_task_completed: