27#ifndef PREPROCESSIMAGE_HPP
28#define PREPROCESSIMAGE_HPP
30#include "convertimage.hpp"
31#include "mycroplayer.hpp"
32#include <opencv2/core/core.hpp>
33#include <opencv2/imgproc.hpp>
36#include "opencvlib_export.h"
39class OPENCVLIB_EXPORT PreprocessImage
43 static cv::Mat deskewRotate(cv::Mat &image);
44 static void setPoints(std::vector<cv::Point2f> pt);
45 static std::vector<cv::Point2f> getPoints(cv::Mat &src);
46 static void preProcess(cv::Mat &src, cv::Mat &dst);
47 static void toGray(cv::Mat &image, uint8_t blurValue = 3);
49 static void adaptThreshold(cv::Mat &image,
50 bool isMorphOp =
false,
51 uint8_t morphKernel = 3,
52 uint8_t blurValue = 3);
53 static cv::Mat adjustBrightness(cv::Mat &in,
int value, cv::Rect rect);
54 static cv::Mat adjustContrast(cv::Mat &in,
int beta);
55 static cv::Mat manualThreshold(cv::Mat &image,
int threshValue = 128, uint8_t blurValue = 3);
56 static cv::Mat adjustSaturation(cv::Mat &in,
int value);
58 static cv::Mat dilate(cv::Mat &in);
59 static cv::Mat canny(cv::Mat &in);
60 static cv::Mat warp(cv::Mat &in);
61 static cv::Mat medianBlur(cv::Mat &in);
62 static cv::Mat gaussianBlur(cv::Mat &in);
63 static cv::Mat
hue(cv::Mat matrix,
int h_shift);
65 static cv::Mat sharpness(cv::Mat matrix,
double beta);
66 static cv::Mat gamma(cv::Mat matrix,
double gamma);
67 static void hedEdgeDetectDNN(cv::Mat &image,
68 std::string &prototxt,
69 std::string &caffemodel,
71 static bool compareContourAreas(std::vector<cv::Point> &contour1,
72 std::vector<cv::Point> &contour2);
73 static bool compareXCords(cv::Point &p1, cv::Point &p2);
74 static bool compareYCords(cv::Point &p1, cv::Point &p2);
75 static bool compareDistance(std::pair<cv::Point, cv::Point> &p1,
76 std::pair<cv::Point, cv::Point> &p2);
77 static double _distance(cv::Point &p1, cv::Point &p2);
78 static void resizeToHeight(cv::Mat &src, cv::Mat &dst,
int height);
79 static void orderPoints(std::vector<cv::Point> &inpts, std::vector<cv::Point> &ordered);
80 static void fourPointTransform(cv::Mat &src, cv::Mat &dst, std::vector<cv::Point> &pts);
81 static double computeSkew(cv::Mat src);
82 static void CalcBlockMeanVariance(cv::Mat& Img, cv::Mat& Res,
float blockSide = 21);
85 static std::vector<cv::Point> poi;
KGUIADDONS_EXPORT qreal hue(const QColor &)