-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathvideo_viewer.hpp
41 lines (35 loc) · 1.25 KB
/
video_viewer.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#pragma once
#include "mat_viewer.hpp"
#include <imgui/imgui.h>
class VideoViewer{
public:
/*
Binds this VideoViewer to an existing VideoCapture instance.
*/
VideoViewer(VideoCapture& videoCapture);
/*
Uses ImGui to render an image preview.
The first parameter, manualPlayback, adds human-readable controls for the playback of the
video, including advancing to the next frame and scrubbing through a video feed.
The second parameter, imageControls, adds display controls like the apparent size of the image
on the display.
*/
void addToGUI(bool manualPlayback = true, bool imageControls = true);
/*Returns the index of the current frame*/
int getCurrentFrame();
/*Sets the index of the current frame*/
void setCurrentFrame(int desiredFrame);
/*Attempts to advance to the next frame. This is a blocking function and may take time*/
bool nextFrame();
/*Returns the number of accessible frames in the video feed*/
int numFrames();
/*The current OpenCV image*/
Mat mat;
/*The address of the current video feed*/
VideoCapture* video;
private:
/*This class relies on MatViewer to render the matrix*/
MatViewer* matViewer;
/*True if playing*/
bool isPlaying = false;
};