#ifndef MINDVISION_CAMERA_H #define MINDVISION_CAMERA_H #include #include #include // MindVision SDK 头文件 - 可能需要根据实际SDK文件调整 extern "C" { #include "CameraApi.h" // 这是MindVision SDK的典型头文件 } class MindVisionCamera { public: int camera_handle; // MindVision SDK中的相机句柄 bool is_opened; std::string target_color; int width; int height; int fps; unsigned char* g_pRgbBuffer; // 处理后数据缓存区 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); private: void set_camera_parameters(); bool initialize_camera(int cam_id); }; #endif // MINDVISION_CAMERA_H