27 #include <opencv2/opencv.hpp>
78 void start(
float viewportWdivH);
111 const string& configPath);
146 #ifndef SL_EMSCRIPTEN
CVVideoType
Video type if multiple exist on mobile devices.
@ VT_SCND
Selfie camera on mobile devices.
@ VT_FILE
Loads a video from file with OpenCV.
@ VT_NONE
No camera needed.
@ VT_MAIN
Main camera on all on all all devices.
CVPixelFormatGL
Pixel format according to OpenGL pixel format defines.
cv::VideoCapture CVVideoCapture
vector< cv::Size > CVVSize
Interface to access the camera through the browser.
Encapsulation of the OpenCV Capture Device and holder of the last frame.
CVCamera scndCam
camera representation for secondary video camera
CVVideoCapture _captureDevice
OpenCV capture device.
void moveCapturePosition(int n)
Moves the current frame position in a video file.
bool hasSecondaryCamera
flag if device has secondary camera
~CVCapture()
Private constructor.
void loadCalibrations(const string &computerInfo, const string &configPath)
CVVSize camSizes
All possible camera sizes.
CVCamera * activeCamera
Pointer to the active camera.
void copyYUVPlanes(float scrWdivH, int srcW, int srcH, uchar *y, int ySize, int yPixStride, int yLineStride, uchar *u, int uSize, int uPixStride, int uLineStride, uchar *v, int vSize, int vPixStride, int vLineStride)
Copies and converts the video image in YUV_420 format to RGB and Grayscale.
CVPixelFormatGL format
GL pixel format.
CVSize captureSize
size of captured frame
void setCameraSize(int sizeIndex, int sizeIndexMax, int width, int height)
void adjustForSL(float viewportWdivH)
Does all adjustments needed for the gVideoTexture.
CVSize2i open(int deviceNum)
Opens the capture device and returns the frame size.
void start(float viewportWdivH)
starts the video capturing
CVMat lastFrameFull
last frame grabbed in BGR and full resolution
CVCapture()
private onetime constructor
CVMat lastFrame
last frame grabbed in BGR
string videoFilename
video filename to load
CVVideoType _videoType
Flag for using the live video image.
CVMat lastFrameGray
last frame in grayscale
CVSize2i openFile()
Opens the video file instead of a camera feed.
int activeCamSizeIndex
Currently active camera size index.
CVCamera videoFileCam
camera representation for simulation using a video file
CVCamera mainCam
camera representation for main video camera
static CVCapture * instance()
Public static instance getter for singleton pattern.
int nextFrameIndex()
Returns the next frame index number.
AvgFloat & captureTimesMS()
get number of frames in video
void loadIntoLastFrame(float vieportWdivH, int camWidth, int camHeight, CVPixelFormatGL srcPixelFormat, const uchar *data, bool isContinuous)
AvgFloat _captureTimesMS
Averaged time for video capturing in ms.
HighResTimer _timer
High resolution timer.
bool videoLoops
flag if video should loop
float startCaptureTimeMS
start time of capturing in ms
static CVCapture * _instance
global singleton object
bool grabAndAdjustForSL(float viewportWdivH)
High Resolution Timer class using C++11.
Interface to access the camera in the browser.
Utils::Averaged< float > AvgFloat