-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathImageFilter.h
More file actions
112 lines (90 loc) · 2.88 KB
/
ImageFilter.h
File metadata and controls
112 lines (90 loc) · 2.88 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
//
// Created by heihei on 2020/5/19.
//
#ifndef QT_OPENCV_IMAGEFILTER_H_
#define QT_OPENCV_IMAGEFILTER_H_
#include <opencv2/opencv.hpp>
#include "utils.h"
class ImageFilter
{
public:
/**
* @brief The Constructor of ImageFilter
*/
ImageFilter();
/**
* @brief Destructor of ImageFilter
*/
~ImageFilter() = default;
/**
* @brief The Filter of change saturation
* @param img The source image
* @param value The degree of change
* @return The mat after change
*/
static cv::Mat FilterSaturation(cv::Mat &img, int value);
/**
* @brief The Filter of change Contrast
* @param img The source image
* @param value_alpha value_contrast
* @param value_beta value_brightness
* @return The mat after change
*/
static cv::Mat FilterDistinctive(cv::Mat &img, double value_alpha, int value_beta);
/**
* @brief The Filter of change Contrast
* @param img The source image
* @param value_alpha The degree of source image
* @param value_beta The degree of blur image
* @return The mat after change
*/
static cv::Mat FilterSharpen(cv::Mat &img, double value_alpha, double value_beta);
/**
* @brief The Filter of Nostalgia Style
* @param img The source image
* @return The mat after change
*
* Nostalgia Style
* R = 0.393r + 0.769g + 0.189b
* G = 0.349r + 0.686g + 0.168b
* B = 0.272r + 0.534g + 0.131b
*/
static cv::Mat FilterNostalgia(cv::Mat &img);
/**
* @brief The Filter of Ground Glass Style
* @param img The source image
* @return The mat after change
*/
static cv::Mat FilterGroundGlass(cv::Mat &img, int value);
/**
* @brief The Filter of Comics Style
* @param img The source image
* @return The mat after change
*
* Comics Style
* R = abs(g - b + g + r) * r / 256
* G = abs(b - g + b + r) * r / 256
* B = abs(b - g + b + r) * g / 256
*/
static cv::Mat FilterComics(cv::Mat &img);
/**
* @brief The Filter of Comics Style
* @param img The source image
* @param value The degree of value
* @return The mat after change
*/
static cv::Mat FilterEmergence(cv::Mat &img, double value);
/**
* @brief The Filter of Vignetting Style
* @param img img The source image
* @param radius The degree of value radius
* @param power The degree of value power
* @return The mat after change
*/
static cv::Mat FilterVignetting(cv::Mat &img, double radius, double power);
private:
static double getDistance(const cv::Point& point_1, const cv::Point& point_2);
static double getMaxDisFromCorners(const cv::Size& imgSize, const cv::Point& center);
static void generateGradient(cv::Mat &mask, double radius, double power);
};
#endif //QT_OPENCV_IMAGEFILTER_H_