#pragma once #include 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); };