表格线识别通用库文档
载入中...
搜索中...
未找到
cm::ImagePreprocessor类 参考

图像预处理器类 更多...

#include <image_preprocess.hpp>

类 cm::ImagePreprocessor 继承关系图:

Public 成员函数

 ImagePreprocessor ()=default
 图像预处理器类的默认构造函数
 
 ImagePreprocessor (const ImagePreprocessor &img_preprocessor)=default
 图像预处理器类的拷贝构造函数
 
virtual ~ImagePreprocessor ()=default
 图像预处理器类的析构函数
 
ImagePreprocessor operator| (const ImagePreprocessor &img_preprocessor) const
 图像预处理器类重载 | 运算符
 
ImagePreprocessoroperator|= (const ImagePreprocessor &img_preprocessor)
 图像预处理器类重载 |= 运算符
 
ImagePreprocessorAddAction (const ImagePreprocessor &img_preprocessor)
 增加图像预处理动作
 
cv::Mat operator() (const cv::Mat &image) const
 图像预处理器类重载括号运算符
 
virtual cv::Mat Preprocess (const cv::Mat &image) const
 预处理图像
 

详细描述

图像预处理器类

该类用于对图像进行一系列预处理操作。

示例
// 测试函数,image是RGB三通道图
void Test(cv::Mat image) {
// 获取自适应二值图
// 获取OTSU二值图
cm::imp::ImagePreprocessor impr = cm::imp::THRESHOLD_COMMON;
binary_image = impr.Preprocess(image);
// 获取图片中的实横线结果图(使用自适应二值化作为预处理)
auto hline_image = impr.Preprocess(image);
// 获取图片中的长虚竖线结果图(使用OTSU二值化作为预处理)
// 自定义实竖线检测和虚横线检测预处理器
const int min_len = 207 / 2; // 设置检测竖线的最小长度
const double min_len_ratio = 0.5; // 设置检测横线最小长度占比(整张图片宽度的占比)
auto vlines = binary_image.GetLines(cm::VLINE, impr1, max_len, max_len, 2) // 二值图获取实竖线
// ...
}
点类
Definition point.hpp:52
static const struct cm::imp::LinesDetection::DashedLinesDetection DASHED
虚线
static const struct cm::imp::LinesDetection::SolidLinesDetection SOLID
实线
const Binarization THRESHOLD_ADAPTIVE(Binarization::ADAPTIVE)
自适应二值化默认参数
const LinesDetection LD_SOLID_H(LinesDetection::SOLID, HLINE)
默认参数实横线检测(支持任意长度线的霍夫直线检测)
const LinesDetection LD_DOTTED_V(LinesDetection::DOTTED, VLINE)
默认参数点竖线(由小线段或点构成的线)检测(仅支持长线的霍夫直线检测)
const Binarization THRESHOLD_COMMON(Binarization::COMMON)
通用二值化默认参数
@ HLINE
横线 (horizontal line)
Definition enum.h:24
@ VLINE
竖线 (vertical line)
Definition enum.h:26
作者
dreamy-xay
日期
2023-12-17

在文件 image_preprocess.hpp70 行定义.

构造及析构函数说明

◆ ImagePreprocessor() [1/2]

cm::ImagePreprocessor::ImagePreprocessor ( )
default

图像预处理器类的默认构造函数

◆ ImagePreprocessor() [2/2]

cm::ImagePreprocessor::ImagePreprocessor ( const ImagePreprocessor & img_preprocessor)
default

图像预处理器类的拷贝构造函数

◆ ~ImagePreprocessor()

virtual cm::ImagePreprocessor::~ImagePreprocessor ( )
virtualdefault

图像预处理器类的析构函数

成员函数说明

◆ AddAction()

ImagePreprocessor & cm::ImagePreprocessor::AddAction ( const ImagePreprocessor & img_preprocessor)
inline

增加图像预处理动作

该函数将另一个图像预处理器对象中的预处理动作列表添加到当前图像预处理器对象的动作列表中,这样就能实现一次性对图片进行多种操作。

注意
添加动作的方式是在后面追加,是不会插入到之前已经声明好的动作。
参数
img_preprocessor图像预处理器
返回
类自身引用,方便链式调用
作者
dreamy-xay
日期
2024-01-27

在文件 image_preprocess.hpp147 行定义.

◆ operator()()

cv::Mat cm::ImagePreprocessor::operator() ( const cv::Mat & image) const
inline

图像预处理器类重载括号运算符

该重载运算符将使用类成员函数 Preprocess 对图像进行预处理,功能和类成员函数 Preprocess 一致。

参数
image需要预处理的图像
返回
预处理后的图像
作者
dreamy-xay
日期
2024-01-27

在文件 image_preprocess.hpp164 行定义.

函数调用图:

◆ operator|()

ImagePreprocessor cm::ImagePreprocessor::operator| ( const ImagePreprocessor & img_preprocessor) const
inline

图像预处理器类重载 | 运算符

该运算符用于将另一个图像预处理器的预处理动作列表添加到当前图像预处理器的动作列表中,这样就能实现一次性对图片进行多种操作,功能和类成员函数 AddAction 一致。

注意
添加动作的方式是在后面追加,是不会插入到之前已经声明好的动作。
参数
img_preprocessor图像预处理器
返回
类本身,方便链式调用
作者
dreamy-xay
日期
2024-01-27

在文件 image_preprocess.hpp108 行定义.

◆ operator|=()

ImagePreprocessor & cm::ImagePreprocessor::operator|= ( const ImagePreprocessor & img_preprocessor)
inline

图像预处理器类重载 |= 运算符

该运算符用于将另一个图像预处理器的预处理动作列表添加到当前图像预处理器的动作列表并且返回,这样就能实现一次性对图片进行多种操作,功能和类成员函数 AddAction 一致。

注意
添加动作的方式是在后面追加,是不会插入到之前已经声明好的动作。
参数
img_preprocessor图像预处理器
返回
类自身引用,方便链式调用
作者
dreamy-xay
日期
2024-01-27

在文件 image_preprocess.hpp128 行定义.

◆ Preprocess()

cv::Mat cm::ImagePreprocessor::Preprocess ( const cv::Mat & image) const
inlinevirtual

预处理图像

该函数对传入的图像进行预处理,依次应用当前图像预处理器对象中存储的各项预处理动作,并返回最终预处理后的图像

注意
预处理动作的执行顺序遵循类似队列的方式,即最先添加的预处理动作会被最先执行。
参数
image需要预处理的图像
返回
预处理后的图像
作者
dreamy-xay
日期
2024-01-27

cm::imp::Binarization, cm::imp::EdgeDetection , 以及 cm::imp::LinesDetection 重载.

在文件 image_preprocess.hpp181 行定义.

这是这个函数的调用关系图:

该类的文档由以下文件生成: