code_device/hgdriver/hgdev/imgproc-pak/fill_hole.h

198 lines
4.3 KiB
C++

#pragma once
// image processor
//
// created on 2023-11-07
//
// ver: 1.0
//
// NOTE: the interface is for all algorithms are in ONE module
#include <imgprc/img_processor.h>
class hole_filler : public image_processor
{
bool left_ = false;
double left_ratio_ = .0f;
bool right_ = false;
double right_ratio_ = .0f;
bool top_ = false;
double top_ratio_ = .0f;
bool bottom_ = false;
double bottom_ratio_ = .0f;
int dpi_ = 200;
int threshold_ = 50;
public:
hole_filler();
protected:
virtual ~hole_filler();
public:
virtual int set_value(const char* name, void* val) override;
virtual void enable(const char* name, bool able) override;
virtual int process(const std::vector<PROCIMGINFO>& in, std::vector<PROCIMGINFO>& out) override;
};
//{
// "is-rid-hole-l": {
// "cat": "base",
// "group": "imgp",
// "title": "穿孔移除—左侧",
// "desc": "穿孔在纸张上的左侧",
// "type": "bool",
// "pos": 10,
// "fix-id": 34879,
// "size": 4,
// "cur": false,
// "default": false
// },
// "search-hole-range-l": {
// "cat": "base",
// "group": "imgp",
// "title": " 左侧穿孔搜索范围占幅面比例",
// "desc": "穿孔搜索范围占幅面比例",
// "type": "float",
// "pos": 10,
// "fix-id": 34880,
// "size": 8,
// "cur": 0.000000,
// "default": 0.000000,
// "range": {
// "min": 0.000000,
// "max": 0.500000,
// "step": 0.050000
// },
// "depend": "is-rid-hole-l==true"
// },
// "is-rid-hole-r": {
// "cat": "base",
// "group": "imgp",
// "title": "穿孔移除—右侧",
// "desc": "穿孔在纸张上的右侧",
// "type": "bool",
// "pos": 10,
// "fix-id": 34881,
// "size": 4,
// "cur": false,
// "default": false
// },
// "search-hole-range-r": {
// "cat": "base",
// "group": "imgp",
// "title": " 右侧穿孔搜索范围占幅面比例",
// "desc": "穿孔搜索范围占幅面比例",
// "type": "float",
// "pos": 10,
// "fix-id": 34882,
// "size": 8,
// "cur": 0.000000,
// "default": 0.000000,
// "range": {
// "min": 0.000000,
// "max": 0.500000,
// "step": 0.050000
// },
// "depend": "is-rid-hole-r==true"
// },
// "is-rid-hole-t": {
// "cat": "base",
// "group": "imgp",
// "title": "穿孔移除—上侧",
// "desc": "穿孔在纸张的上部",
// "type": "bool",
// "pos": 10,
// "fix-id": 34883,
// "size": 4,
// "cur": false,
// "default": false
// },
// "search-hole-range-t": {
// "cat": "base",
// "group": "imgp",
// "title": " 上侧穿孔搜索范围占幅面比例",
// "desc": "穿孔搜索范围占幅面比例",
// "type": "float",
// "pos": 10,
// "fix-id": 34884,
// "size": 8,
// "cur": 0.000000,
// "default": 0.000000,
// "range": {
// "min": 0.000000,
// "max": 0.500000,
// "step": 0.050000
// },
// "depend": "is-rid-hole-t==true"
// },
// "is-rid-hole-b": {
// "cat": "base",
// "group": "imgp",
// "title": "穿孔移除—下侧",
// "desc": "穿孔在纸张的下部",
// "type": "bool",
// "pos": 10,
// "fix-id": 34885,
// "size": 4,
// "cur": false,
// "default": false
// },
// "search-hole-range-b": {
// "cat": "base",
// "group": "imgp",
// "title": " 下侧穿孔搜索范围占幅面比例",
// "desc": "穿孔搜索范围占幅面比例",
// "type": "float",
// "pos": 10,
// "fix-id": 34886,
// "size": 8,
// "cur": 0.000000,
// "default": 0.000000,
// "range": {
// "min": 0.000000,
// "max": 0.500000,
// "step": 0.050000
// },
// "depend": "is-rid-hole-b==true"
// },
// "hole-threshold": {
// "cat": "base",
// "group": "imgp",
// "title": "孔洞阈值",
// "desc": "孔洞像素大小阈值(小于阈值不当作孔洞)",
// "type": "int",
// "unit": "pixel",
// "size": 4,
// "cur": 50,
// "default": 50,
// "range": {
// "min": 5,
// "max": 100,
// "step": 1
// },
// "depend": "is-rid-hole-l==true || is-rid-hole-r==true || is-rid-hole-t==true || is-rid-hole-b==true"
// },
// "resolution": {
// "cat": "base",
// "group": "base",
// "title": "分辨率",
// "desc": "设置扫描图像的分辨率",
// "type": "int",
// "pos": 10,
// "fix-id": 34840,
// "size": 4,
// "cur": 200,
// "default": 200,
// "range": {
// "min": 100,
// "max": {
// "default": 600,
// "paper==最大扫描尺寸自动裁切 || paper==最大扫描尺寸 || paper==三联试卷": 500
// },
// "step": 1
// }
// }
//}