SLProject
4.2.000
A platform independent 3D computer graphics framework for desktop OS, Android, iOS and online in web browsers
WebCamera.h
Go to the documentation of this file.
1
/**
2
* \file WebCamera.h
3
* \brief Interface to access the camera through the browser.
4
* \date October 2022
5
* \authors Marino von Wattenwyl
6
* \copyright http://opensource.org/licenses/GPL-3.0
7
* \remarks Please use clangformat to format the code. See more code style on
8
* https://github.com/cpvrlab/SLProject4/wiki/SLProject-Coding-Style
9
*/
10
11
#ifndef SLPROJECT_WEBCAMERA_H
12
#define SLPROJECT_WEBCAMERA_H
13
14
#include <
CVTypedefs.h
>
15
16
//-----------------------------------------------------------------------------
17
//! Facing modes for the camera
18
enum class
WebCameraFacing
19
{
20
FRONT
= 0,
21
BACK
= 1
22
};
23
//-----------------------------------------------------------------------------
24
//! Interface to access the camera in the browser
25
class
WebCamera
26
{
27
public
:
28
void
open
(
WebCameraFacing
facing);
29
bool
isReady
();
30
CVMat
read
();
31
CVSize2i
getSize
();
32
void
setSize
(
CVSize2i
size);
33
void
close
();
34
35
// Getters
36
bool
isOpened
() {
return
_isOpened
; }
37
38
private
:
39
bool
_isOpened
=
false
;
40
CVMat
_image
;
41
CVMat
_imageBGR
;
42
bool
_waitingForResize
=
false
;
43
};
44
//-----------------------------------------------------------------------------
45
#endif
// SLPROJECT_WEBCAMERA_H
CVTypedefs.h
CVSize2i
cv::Size2i CVSize2i
Definition:
CVTypedefs.h:56
CVMat
cv::Mat CVMat
Definition:
CVTypedefs.h:38
WebCameraFacing
WebCameraFacing
Facing modes for the camera.
Definition:
WebCamera.h:19
WebCameraFacing::BACK
@ BACK
WebCameraFacing::FRONT
@ FRONT
WebCamera
Interface to access the camera in the browser.
Definition:
WebCamera.h:26
WebCamera::_imageBGR
CVMat _imageBGR
Definition:
WebCamera.h:41
WebCamera::close
void close()
Closes the video stream.
Definition:
WebCamera.cpp:192
WebCamera::isReady
bool isReady()
Returns whether the video stream has been acquired.
Definition:
WebCamera.cpp:57
WebCamera::open
void open(WebCameraFacing facing)
Acquires a video stream.
Definition:
WebCamera.cpp:23
WebCamera::read
CVMat read()
Reads the current frame.
Definition:
WebCamera.cpp:68
WebCamera::isOpened
bool isOpened()
Definition:
WebCamera.h:36
WebCamera::_waitingForResize
bool _waitingForResize
Definition:
WebCamera.h:42
WebCamera::_image
CVMat _image
Definition:
WebCamera.h:40
WebCamera::setSize
void setSize(CVSize2i size)
Requests a video size from the browser.
Definition:
WebCamera.cpp:149
WebCamera::_isOpened
bool _isOpened
Definition:
WebCamera.h:39
WebCamera::getSize
CVSize2i getSize()
Gets the size of the video input.
Definition:
WebCamera.cpp:123
apps
source
WebCamera.h
Generated by
1.9.1