Exemple #1
0
def main(args: typing.List[str]) -> int:
    """Analyse video file or camera for motion. If no file is entered, the first camera is used."""
    video_file = None
    config = read_config()
    frame_processor = FrameProcessor(config)
    if len(args) > 1:
        video_file = args[1]
    frame_processor.capture(video_file)
    return 0
Exemple #2
0
def main(args: typing.List[str]) -> int:
    """Analyse video file or camera for motion. If no file is entered, the first camera is used."""
    video_file = None
    config = read_config()
    logger = setup_custom_logger("COLLECTOR")
    logger.info("Application started")

    parser = argparse.ArgumentParser()
    parser.add_argument("-f",
                        "--file",
                        help="Process video file",
                        action='store_true')
    parser.add_argument(
        "-l",
        "--list",
        help="Process .txt file that contains a list of video files",
        action='store_true')
    parser.add_argument("filename", type=str, nargs='?', default="")

    args = parser.parse_args()
    if not args.list:
        frame_processor = FrameProcessor(config, logger)
        if args.file:
            video_file = args.filename
        frame_processor.capture(video_file)
        return 0
    else:
        file = open(args.filename, "r")
        while True:
            next_video_file = file.readline()
            if len(next_video_file) > 0:
                next_video_file = next_video_file.rstrip('\n')
                next_video_file = next_video_file.strip()
                if len(next_video_file) > 0 and next_video_file[0] != '#':
                    frame_processor = FrameProcessor(config, logger)
                    frame_processor.capture(next_video_file)
            else:
                break

        file.close
        return 0
Exemple #3
0
def start_camera_analysis():
    print("Starting Camera Analysis")

    calibration = np.load('./calibration_1080.npz')
    frame_processor = FrameProcessor(calibration, camera_index=cam_index, debug_mode=debug)
    frame_processor.init_camera()

    while server_running:
        frame_processor.capture()
        transforms = frame_processor.proccess()
        if transforms:
            try:
                cloned_clients = clients[:]
            except:
                continue

            send_transforms(cloned_clients, transforms)

        if cv2.waitKey(1) & 0xFF == ord('q'):
            continue

    print("Stopping Camera Analysis")