46 lines
1.1 KiB
C++
46 lines
1.1 KiB
C++
// utils.h
|
|
#ifndef IMG_UTILS_H
|
|
#define IMG_UTILS_H
|
|
|
|
#include <QPixmap>
|
|
#include <QImage>
|
|
#include <opencv2/opencv.hpp>
|
|
#include <Mil.h>
|
|
#include <utility>
|
|
|
|
extern MIL_ID MilSystem;
|
|
|
|
class ImageUtils
|
|
{
|
|
public:
|
|
ImageUtils(); // 构造函数
|
|
|
|
// 将 cv::Mat 转换为 QPixmap 的静态函数
|
|
static QPixmap mat2QPixmap(const cv::Mat& mat);
|
|
|
|
// 将 MIL_ID 转换为 cv::Mat 的静态函数
|
|
static cv::Mat mil2Mat(const MIL_ID mil_img);
|
|
|
|
static void convert_to_uint8(const MIL_ID& input_img, MIL_ID& output_img);
|
|
|
|
static cv::Mat overlayResultOnInput(const cv::Mat& cv_input, const cv::Mat& total_result, double alpha = 0.5, int colormap = cv::COLORMAP_JET);
|
|
|
|
static std::vector<std::vector<uint8_t>> mergeMasks(
|
|
const std::vector<std::vector<uint8_t>>& mask1,
|
|
const std::vector<std::vector<uint8_t>>& mask2,
|
|
int offset_y = 0
|
|
);
|
|
|
|
|
|
static std::pair<std::vector<std::vector<uint8_t>>, std::vector<std::vector<uint8_t>>>
|
|
extractROI(
|
|
const std::vector<std::vector<uint8_t>>& merged_mask,
|
|
int roi_x,
|
|
int roi_y,
|
|
int roi_width,
|
|
int roi_height
|
|
);
|
|
};
|
|
|
|
#endif // IMG_UTILS_H
|