Пример #1
0
cv2.namedWindow("trackbars", cv2.WINDOW_AUTOSIZE)
cv2.createTrackbar("pupilThr", "trackbars", 0, 255, onSlidersChange)
cv2.createTrackbar("pupilMinimum", "trackbars", 10, 40, onSlidersChange)
cv2.createTrackbar("pupilMaximum", "trackbars", 50, 100, onSlidersChange)
cv2.imshow("trackbars", np.zeros((1, 640), np.uint8))

# Create a capture video object.
# Tips: You can add a new video capture device or video file with the method
# CaptureVideo.addInputVideo().
capture = CaptureVideo(isDebugging=True)
capture.addInputVideo(uid, size=(640, 480), framerate=30.)

# Create a record video object.
# Tips: You can add a new output video file with the method
# RecordVideo.addOutputVideo().
record = RecordVideo(False)
record.addOutputVideo("Outputs/" + args["output"],
                      size=(640, 480),
                      framerate=30.,
                      isColor=True)

# Start the record thread.
record.startThread()

# This repetion will run while there is a new frame in the video file or
# while the user do not press the "q" (quit) keyboard button.
while True:
    # Capture frame-by-frame.
    retval, frames = capture.getFrames()

    # Check if there is a valid frame.
Пример #2
0
from CaptureVideo.CaptureVideo import CaptureVideo
from RecordVideo.RecordVideo   import RecordVideo

########################################################################

# Create a capture video object.
# Tips: You can add a new video capture device or video file with the method
# CaptureVideo.addInputVideo().
capture = CaptureVideo(isDebugging=True)
capture.addInputVideo(0, size=(640, 480), framerate=30.)

# Create a record video object.
# Tips: You can add a new output video file with the method
# RecordVideo.addOutputVideo().
record = RecordVideo(True)
record.addOutputVideo("Outputs/warmUpVideo.mp4", size=(640, 480), framerate=30., isColor=False)

# Start the record thread.
record.startThread()

# This repetion will run while there is a new frame in the video file or
# while the user do not press the "q" (quit) keyboard button.
while True:
    # Capture frame-by-frame.
    retval, frames = capture.getFrames()

    # Check if there is a valid frame.
    if not retval:
        break