40 lines
929 B
C++
40 lines
929 B
C++
// perform crop, deskew, fill background ...
|
|
//
|
|
// Date: 2024-01-24
|
|
#pragma once
|
|
|
|
#include <imgprc/img_processor.h>
|
|
#include <map>
|
|
#include <base/paper.h>
|
|
|
|
class auto_crop : public image_processor
|
|
{
|
|
bool crop_ = true; // auto crop
|
|
bool deskew_ = true;
|
|
bool fill_bg_ = true;
|
|
bool convex_ = true;
|
|
bool fill_clr_ = false;
|
|
int threshold_ = 10;
|
|
int indent_ = 5;
|
|
int noise_ = 8;
|
|
SIZE fixed_paper_ = {0, 0};
|
|
bool lateral_ = false;
|
|
|
|
std::map<std::string, std::function<void(void*)>> opt_handler_;
|
|
|
|
void init(void);
|
|
int work(PROCIMGINFO& in, PROCIMGINFO& out);
|
|
|
|
public:
|
|
auto_crop();
|
|
|
|
protected:
|
|
~auto_crop();
|
|
|
|
public:
|
|
virtual int set_value(const char* name/*nullptr for all options*/, void* val/*nullptr for restore*/) override;
|
|
|
|
public:
|
|
virtual int process(std::vector<PROCIMGINFO>& in, std::vector<PROCIMGINFO>& out) override;
|
|
};
|