2024-05-24 19:10:41 +08:00
|
|
|
#ifndef _CAPTURE_H__
|
|
|
|
|
#define _CAPTURE_H__
|
|
|
|
|
|
|
|
|
|
#include <thread>
|
|
|
|
|
#include <iostream>
|
|
|
|
|
#include <opencv2/highgui.hpp>
|
|
|
|
|
#include <zmq.hpp>
|
|
|
|
|
|
|
|
|
|
class capture
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
int index;
|
|
|
|
|
int port;
|
|
|
|
|
int width;
|
|
|
|
|
int height;
|
|
|
|
|
int fps;
|
|
|
|
|
bool status = false;
|
2024-06-17 22:16:28 +08:00
|
|
|
bool flip = false;
|
2024-05-24 19:10:41 +08:00
|
|
|
char zmq_bind_addr[40] = "tcp://*:";
|
2024-06-17 22:16:28 +08:00
|
|
|
|
2024-07-04 17:50:05 +08:00
|
|
|
std::thread *thread_capture;
|
|
|
|
|
std::thread *thread_request;
|
2024-05-24 19:10:41 +08:00
|
|
|
cv::VideoCapture *cap;
|
|
|
|
|
cv::Mat frame;
|
|
|
|
|
zmq::context_t *context;
|
|
|
|
|
zmq::socket_t *socket;
|
|
|
|
|
|
2024-06-17 22:16:28 +08:00
|
|
|
capture(int camera_index, int zmq_port, int width_set = 320, int height_set = 240, int fps_set = 20, bool flip = false);
|
2024-05-24 19:10:41 +08:00
|
|
|
void start(void);
|
2024-07-04 17:50:05 +08:00
|
|
|
void get(void);
|
|
|
|
|
void req(void);
|
2024-05-24 19:10:41 +08:00
|
|
|
bool is_open(void);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
#endif
|