Exemplo n.º 1
0
        # image = np.zeros((frame_height, frame_width*ndev, 3), dtype=np.uint8)

        # --- ROI ---
        for (i, fm) in enumerate(frame):
            sx = frame_width * (i % nwx)
            sy = frame_height * int(i / nwx)
            ex = frame_width * (i % nwx + 1)
            ey = frame_height * int(1 + i / nwx)
            image[sy:ey, sx:ex] = fm

        cv2.imshow(__file__, image)

        tnow = datetime.now().strftime('%Y%m%d_%H_%M_%S_%f')
        if (tnow != tnow0):
            put_text(image, tnow)
            basedir = '../log/'
            ofname = mkdir.get_filename_frame(basedir, tnow)
            cv2.imwrite(ofname, image)
            print(ofname)
            tnow0 = tnow

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

    for (i, fm) in enumerate(frame):
        cap[i].release()

    cv2.destroyAllWindows()

    print("Done.")
Exemplo n.º 2
0
    cap_height = cap.get(cv2.CAP_PROP_FRAME_HEIGHT)
    cap_fps = cap.get(cv2.CAP_PROP_FPS)

    print(cap_width, "x", cap_height, ":", cap_fps)

    tnow0 = datetime.now().strftime(
        '%Y%m%d_%H_%M_%S')  # ('%Y%m%d_%H_%M_%S_%f')

    while (cap.isOpened()):
        ret, frame = cap.read()
        cv2.imshow('frame', frame)

        tnow = datetime.now().strftime('%Y%m%d_%H_%M_%S')
        if (tnow != tnow0):
            put_text(frame, tnow)

            if False:
                ofname = mkdir.get_filename_frame('../log/', tnow)
                cv2.imwrite(ofname, frame)
                print(ofname, ": TEST on devid=%d" % devid)

            tnow0 = tnow

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

    cap.release()
    cv2.destroyAllWindows()

    print("Done.")