<< VideoCapture_isOpened | Video reading | delete_VideoCapture >>

scicv >> Video > Video reading > VideoCapture_read

# VideoCapture_read

Grabs and returns the next video frame.

### Syntax

    [ret, frame] = VideoCapture_read(videoCapture)

### Parameters

videoCapture

  Video capture object (VideoCapture).

ret

  Status (boolean).

frame

  The captured frame (Mat).

### Description

`VideoCapture_read` grabs, and returns the next video frame. If no frame can be grabbed (camera disconnected, end of video file) the status ret is `%F`.

### Examples

    scicv_Init();

    videoCapture = new_VideoCapture(getSampleVideo("video.mpg"));
    startWindowThread();
    namedWindow("video.mpg");

    ret = %t;
    while ret
        [ret, frame] = VideoCapture_read(videoCapture);
        imshow("video.mpg", frame);
        if waitKey(40) <> -1 then
            break;
        end
        delete_Mat(frame);
    end

    destroyWindow("video.mpg");
    delete_VideoCapture(videoCapture);

### See also

- new_VideoCapture

Report an issue
<< VideoCapture_isOpened | Video reading | delete_VideoCapture >>