-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathdvp.h
151 lines (108 loc) · 4.75 KB
/
dvp.h
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
#ifndef DVP_H
#define DVP_H
#include "DVPCamera.h"
#include <iostream>
#include <set>
#include <common/debug.hpp>
#include <common/other.hpp>
#include <common/returncode.hpp>
#include <common/image/image.hpp>
#include <common/parameters.hpp>
#include <camera/camera.hpp>
#include <common/capture/capture.hpp>
#include <queue>
#include <atomic>
#include <memory>
#define CAMERA_NO_CAMERA "CAMERA_NO_CAMERA"
#define CAMERA_NO_GETFRAME "CAMERA_NO_GETFRAME"
#define CAMERA_NOSET_GETFRAMEBUFFERED "CAMERA_NOSET_GETFRAMEBUFFERED"
#define DVP_CAM_NULL_POINTER "DVP_CAM_NULL_POINTER"
#define DVP_CAM_IMAGE_BUFFER_EMPTY "DVP_CAM_IMAGE_BUFFER_EMPTY"
#define CAMERA_VIDEO_SAVESET 1 //1保存录像图片 0不保存录像图片
namespace dlp{
class dvpclass : public dlp::Camera
{
public:
dvpclass();
virtual ~dvpclass();
dvpCameraInfo camerainfo; //相机信息
dvpFrame pFrame; //帧信息
dvpUint32 maincount; //相机数目
dvpUint32 timeout; //超时时间(毫秒)(dvpGetFrame)
dvpInt32 quality; //图像品质,仅对jpeg格式有效,并且取值范围是[1,100](dvpSavePicture)
std::string file_name;
const std::string file_new_name = "D:\\photo\\Camera\\100.jpg";
void get_info();
void get_ID(dvpHandle &Handle,dvpOpenMode mode);
void camera_sive_set(dvpHandle &Handle,int Weight,int Hight);//max(1280,1024)
void camera_format_set(dvpHandle &Handle);
void get_oneframe(dvpHandle &Handle);
void get_video(dvpHandle &Handle);
void get_ID(dvpOpenMode mode);
void camera_set(int,int,int,int);
void get_oneframe();
void get_video();
void MW_Restart();//快速重启
void MW_Hold(); //快速暂停
void MW_Start(); //启动
void MW_Stop(); //停止
void MW_Close(); //关闭
bool MW_IsValid();//检查相机句柄是否有效
bool MW_IsOnline();//检查相机是否联机
bool MW_IsHold();//查询视频流是否处于暂停状态
class Parameters{
public:
DLP_NEW_PARAMETERS_ENTRY(Mode, "DVP_PARAMETERS_MODE", unsigned int, OPEN_NORMAL);
DLP_NEW_PARAMETERS_ENTRY(Height, "DVP_PARAMETERS_HEIGHT_PXL", unsigned int, 1024);
DLP_NEW_PARAMETERS_ENTRY(Width, "DVP_PARAMETERS_WIDTH_PXL", unsigned int, 1280);
DLP_NEW_PARAMETERS_ENTRY(ImageFormat, "DVP_PARAMETERS_Image_FORMAT", unsigned int, FORMAT_MONO );
DLP_NEW_PARAMETERS_ENTRY(PixelFormat, "DVP_PARAMETERS_PIXEL_FORMAT", unsigned int, BITS_8);
DLP_NEW_PARAMETERS_ENTRY(FrameRate, "DVP_PARAMETERS_FRAME_RATE_HZ", float, 60.000);
};
// 纯虚函数
dlp::ReturnCode Connect(const std::string &id = "0");
dlp::ReturnCode Disconnect();
dlp::ReturnCode Setup(const dlp::Parameters &settings);
dlp::ReturnCode GetSetup(dlp::Parameters *settings)const;
dlp::ReturnCode Start();
dlp::ReturnCode Stop();
dlp::ReturnCode Hold();
dlp::ReturnCode Close();
dlp::ReturnCode GetFrame(dlp::Image* ret_frame);
dlp::ReturnCode GetFrameBuffered(dlp::Image* ret_frame);
dlp::ReturnCode GetCaptureSequence(const unsigned int &arg_number_captures,
dlp::Capture::Sequence* ret_capture_sequence);
bool isConnected() const;
bool isStarted() const;
bool IsValidHandle() const;
dlp::ReturnCode GetID(std::string* ret_id) const;
dlp::ReturnCode GetRows(unsigned int* ret_rows) const;
dlp::ReturnCode GetColumns(unsigned int* ret_columns) const;
dlp::ReturnCode GetFrameRate(float* ret_framerate) const;
dlp::ReturnCode GetExposure(float* ret_exposure) const;
protected:
void file_name_add();
private:
dvpStatus status; //状态枚举
dvpHandle camera_Handle; //相机句柄
int Camera_ID_count = 0;
int file_name_num = 1;
std::set<std::string>Camera_ID_set;
bool bSoftTrigger = false;
bool bSoftTriggerLoop = false;
// 成员记录摄像机是否已连接或已启动
bool is_connected_;
bool is_started_;
unsigned int packet_size;
float packet_percent;
std::string camera_id_;
Camera::Parameters::FrameBufferSize image_queue_max_frames_;
Parameters::Mode mode_;
Parameters::Height height_;
Parameters::Width width_;
Parameters::ImageFormat image_format_;
Parameters::PixelFormat pixel_format_;
Parameters::FrameRate frame_rate_;
};
}
#endif // DVP_H