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);
48 static cv::Mat grayscale(cv::Mat matrix);
50 static void adaptThreshold(cv::Mat &image,
51 bool isMorphOp =
false,
52 uint8_t morphKernel = 3,
53 uint8_t blurValue = 3);
54 static cv::Mat adjustBrightness(cv::Mat &in,
int value, cv::Rect rect = cv::Rect());
55 static cv::Mat adjustContrast(cv::Mat &in,
int beta);
56 static cv::Mat manualThreshold(cv::Mat &image,
int threshValue = 128, uint8_t blurValue = 3);
57 static cv::Mat adjustSaturation(cv::Mat &in,
int value);
59 static cv::Mat dilate(cv::Mat &in);
60 static cv::Mat canny(cv::Mat &in);
61 static cv::Mat warp(cv::Mat &in);
62 static cv::Mat
hue(cv::Mat matrix,
int h_shift);
64 static cv::Mat sharpness(cv::Mat matrix,
double beta);
65 static cv::Mat gamma(cv::Mat matrix,
double gamma);
66 static void hedEdgeDetectDNN(cv::Mat &image,
67 std::string &prototxt,
68 std::string &caffemodel,
70 static bool compareContourAreas(std::vector<cv::Point> &contour1,
71 std::vector<cv::Point> &contour2);
72 static bool compareXCords(cv::Point &p1, cv::Point &p2);
73 static bool compareYCords(cv::Point &p1, cv::Point &p2);
74 static bool compareDistance(std::pair<cv::Point, cv::Point> &p1,
75 std::pair<cv::Point, cv::Point> &p2);
76 static double _distance(cv::Point &p1, cv::Point &p2);
77 static void resizeToHeight(cv::Mat &src, cv::Mat &dst,
int height);
78 static void orderPoints(std::vector<cv::Point> &inpts, std::vector<cv::Point> &ordered);
79 static void fourPointTransform(cv::Mat &src, cv::Mat &dst, std::vector<cv::Point> &pts);
80 static double computeSkew(cv::Mat src);
81 static void CalcBlockMeanVariance(cv::Mat& Img, cv::Mat& Res,
float blockSide = 21);
84 static std::vector<cv::Point> poi;
KGUIADDONS_EXPORT qreal hue(const QColor &)