PreVerify/lib/XImageCodecs/include/XImagePreprocessor.h

40 lines
788 B
C
Raw Normal View History

2024-09-09 19:18:28 +08:00
#pragma once
#include <opencv2/core.hpp>
class __declspec(dllexport) XImagePreprocessor {
public:
// 限制图像各通道的像素值范围
struct MinMaxPixel {
// 针对彩色图的像素值范围
int minRed = 30;
int maxRed = 220;
int minGreen = 30;
int maxGreen = 220;
int minBlue = 30;
int maxBlue = 220;
// 针对单通道灰度图的像素值范围
int minGray = 30;
int maxGray = 220;
};
struct Params {
MinMaxPixel minMaxPixel;
};
XImagePreprocessor(const Params& params) : params(params) {};
~XImagePreprocessor();
void process(cv::Mat& image);
private:
Params params;
void truncate(cv::Mat& image, const MinMaxPixel& minMaxPixel);
};