Banuba SDK
Toggle main menu visibility
Loading...
Searching...
No Matches
libs
spal
bnb
spal
camera
ocv_based.hpp
1
2
#pragma once
3
4
#include <bnb/types/base_types.hpp>
5
#include <bnb/spal/camera/base.hpp>
6
#include <bnb/utils/warning_ingore.h>
7
8
#if !BNB_OS_MACOS && !BNB_OS_WINDOWS && !BNB_OS_EMSCRIPTEN
9
BNB_NO_WARN_BEGIN_GCC(
"-Wdeprecated-enum-enum-conversion"
)
10
#include <opencv2/videoio.hpp>
11
#include <opencv2/videoio/videoio_c.h>
12
BNB_NO_WARN_END_GCC()
13
14
#include <thread>
15
#include <mutex>
16
17
namespace
bnb
18
{
19
class
BNB_EXPORT camera_ocv :
public
camera_base
20
{
21
public
:
22
explicit
camera_ocv(
const
camera_base::push_frame_cb_t& cb,
size_t
index);
23
~camera_ocv()
override
;
24
25
void
set_device_by_index(uint32_t device_index)
override
;
26
void
set_device_by_id(
const
std::string& device_id)
override
;
27
void
start()
override
;
28
29
private
:
30
void
thread_func();
31
32
void
update_image_content();
33
34
cv::VideoCapture m_capture;
35
36
std::thread m_thread;
37
38
uint32_t m_frame_width{0};
39
uint32_t m_frame_height{0};
40
uint32_t m_frame_size = m_frame_width * m_frame_height;
41
uint32_t m_device_count{0};
42
std::mutex m_mutex;
43
};
44
}
// namespace bnb
45
#endif
bnb::camera_base
Definition
base.hpp:24
Generated by
1.17.0