参考上海交通大学代码进行修改
This commit is contained in:
43
Catalyst-MDVS2/inc/MindVisionCamera.h
Normal file
43
Catalyst-MDVS2/inc/MindVisionCamera.h
Normal file
@@ -0,0 +1,43 @@
|
||||
#ifndef MINDVISION_CAMERA_H
|
||||
#define MINDVISION_CAMERA_H
|
||||
|
||||
#include <opencv2/opencv.hpp>
|
||||
#include <string>
|
||||
#include <memory>
|
||||
|
||||
// MindVision SDK 头文件 - 可能需要根据实际SDK文件调整
|
||||
extern "C" {
|
||||
#include "CameraApi.h" // 这是MindVision SDK的典型头文件
|
||||
}
|
||||
|
||||
class MindVisionCamera {
|
||||
public:
|
||||
CameraHandle camera_handle; // MindVision SDk中的相机句柄
|
||||
bool is_opened;
|
||||
std::string target_color;
|
||||
int width;
|
||||
int height;
|
||||
int fps;
|
||||
unsigned char* g_pRgbBuffer; // 处理后数据缓存区
|
||||
tSdkCameraCapbility capability; // 相机能力信息
|
||||
tSdkImageResolution image_resolution; // 分辨率信息
|
||||
|
||||
MindVisionCamera(int cam_id = 0, const std::string& target_color = "red");
|
||||
~MindVisionCamera();
|
||||
|
||||
bool set_cam_params();
|
||||
bool read_frame(cv::Mat& frame);
|
||||
bool read_frame_with_color_filter(cv::Mat& frame, cv::Mat& mask, const std::string& target_color);
|
||||
void release();
|
||||
bool switch_color(const std::string& target_color);
|
||||
|
||||
int get_width() const { return width; }
|
||||
int get_height() const { return height; }
|
||||
bool set_resolution(int width, int height);
|
||||
|
||||
private:
|
||||
void set_camera_parameters();
|
||||
bool initialize_camera(int cam_id);
|
||||
};
|
||||
|
||||
#endif // MINDVISION_CAMERA_H
|
||||
Reference in New Issue
Block a user