-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathopcvwrapper.h
181 lines (133 loc) · 5.79 KB
/
opcvwrapper.h
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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
//--------------------------------------------------------------------------------------------------
// These functions have been taken from OpenCV documentation and made easier to use
// author: Daniel Vasconcelos Gomes 2022/2023
// if an external code has been used I indicate the sources
//--------------------------------------------------------------------------------------------------
#ifndef _CVWRAPPER_
#define _CVWRAPPER_
#include "image_util.h"
#include <matplot/matplot.h>
/*************************************************************************************
* basic operations
**************************************************************************************/
bool loadImage(const std::string& image_path, Mat& img);
void showImage(const Mat& img, const std::string& title);
bool saveImage(const std::string& image_path, Mat& img);
Mat flipImageHorizontal(const Mat& img);
Mat flipImageVertical(const Mat& img);
Mat flipImage(const Mat& img);
Mat InvertImage(const Mat& img);
Mat getBinaryImage(const Mat& img);
Mat adjustContrast(const Mat& img, int factor);
Mat adjustBrightness(const Mat& img, int factor);
Mat adjustGama(const Mat& img, double);
void plotHistogram(const Mat& img);
/*************************************************************************************
* Gray Scale
**************************************************************************************/
bool isGrayScaleImage(const Mat& img);
Mat convertograyScale(const Mat& img);
/*************************************************************************************
* Equalization
**************************************************************************************/
Mat equalizeGrayImage(const Mat& img);
Mat equalizeColorImage(const Mat& img);
/*************************************************************************************
* Filters
**************************************************************************************/
Mat ApplyThreShold(const Mat& img, double _threshold);
Mat blurImageSmooth(const Mat& img, int kernel_size);
Mat ApplyBilateralFilterExt( const Mat& img,
int kernel_size,
double sigma1,
double sigma2);
Mat GaussianImageSmoothExtended( const Mat& img,
int kernel_size,
double sigmaX,
double sigmaY
);
Mat MedianImageSmooth(const Mat& img, int kernel_size);
Mat ApplyCustomKernel(const Mat& img, Mat& kernel);
/*************************************************************************************
* Hough Transform
**************************************************************************************/
Mat ApplyHoughTransformLines(const Mat& img);
Mat ApplyHoughTransformCircles(const Mat& img);
std::vector<Vec4i>
GetLinesHoughTransform(
const Mat& img,
double rho,
double theta,
double minLineLength,
double maxLineGap);
std::vector<cv::Vec3f>
GetCirclesHoughTransform(
const Mat& img,
int method,
double dp,
double minDist,
double param1,
double param2,
int minRadius,
int maxRadius);
/*************************************************************************************
* Edge detectors Laplacian
**************************************************************************************/
Mat ApplyLaplacianExtended( const Mat& src,
int kernel_size = 3,
int scale = 1,
int delta = 0,
int ddepth = CV_8S);
/*************************************************************************************
* Edge detectors Sobel
**************************************************************************************/
Mat ApplySobelXExtended(const Mat& img,
int image_type,
int depth,
int type,
double delta,
int kernel_size);
Mat ApplySobelYExtended(const Mat& img,
int image_type,
int depth,
int type,
double delta,
int kernel_size);
Mat ApplySobelExtended(const Mat& img,
int image_type,
int depth,
int type,
double delta,
int kernel_size);
/*************************************************************************************
* Morphological
/*************************************************************************************/
Mat ApplyErode(const Mat& img);
Mat ApplyDilate(const Mat& img);
Mat ApplyErodeEx(const Mat& img,int);
Mat ApplyDilateEx(const Mat& img,int);
Mat ApplyClosing(const Mat& img);
Mat ApplyOpening(const Mat& img);
Mat ApplyMorphGradient(const Mat& img);
Mat ApplyTopHatAlgo(const Mat& img);
Mat segmentErode(const Mat& img);
/*************************************************************************************
* Advanced Algorithms
/*************************************************************************************/
Mat ApplyCustomAlgo(const Mat& image);
Mat ApplyCannyAlgoFull(const Mat& img, int threshold = 125, int aperture = 350);
Mat ApplyDifferenceOfGaussian(const Mat& im);
Mat ApplyFindContournsThreshold(const Mat& img);
Mat ApplyFindContournsCanny(const Mat& img);
/*************************************************************************************
* SIFT
/*************************************************************************************/
Mat ApplySiftToImage(const Mat& img);
/*************************************************************************************
* Face/Eye detection
/*************************************************************************************/
std::vector<Rect> detectFacesInImage(Mat& img);
std::vector<Rect> detectEyesInImage(Mat& img);
Mat FindFacesAndDrawRectangles(const Mat& img);
#endif
//--------------------------------------------------------------------------------------------------