-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathConvolution.h
72 lines (55 loc) · 1.67 KB
/
Convolution.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
#pragma once
#include <vector>
#include "Pixel.h"
#include "Image.h"
class Convolution {
public:
Convolution(Image &image);
std::stringstream getFilteredMatrix(int type, int scale_X, int scale_Y);
private:
Pixel<uint8_t> pixelFilter(const std::vector<std::vector<int>> &_kernel, int pixel_X, int pixel_Y, int kernel_center, int type);
Pixel<uint8_t> boxPixelFilter(int scale_X, int scale_Y, int pixel_X, int pixel_Y);
std::vector<std::vector<int>> getFilter(std::vector<std::vector<int>>& _kernel, int type, bool& isBox);
const std::vector<std::vector<int>> identity {
{0, 0, 0},
{0, 1, 0},
{0, 0, 0}
};
const std::vector<std::vector<int>> gaussianBlur3x3 {
{1, 2, 1},
{2, 4, 2},
{1, 2, 2}
};
const std::vector<std::vector<int>> sharpen3x3 {
{0, -1, 0},
{-1, 5, -1},
{0, -1, 0}
};
const std::vector<std::vector<int>> sobel_0 {
{1, 2, 1},
{0, 0, 0},
{-1, -2, -1}
};
const std::vector<std::vector<int>> sobel_1 {
{1, 0, -1},
{2, 0, -2},
{1, 0, -1}
};
const std::vector<std::vector<int>> gaussianBlur5x5 {
{1, 4, 6, 4, 1},
{4, 16, 24, 16, 4},
{6, 24, 36, 24, 6},
{4, 16, 24, 16, 4},
{1, 4, 6, 4, 1}
};
private:
Image ℑ
};
enum filters {
f_o_identity = 0,
f_Gaussian_Blur_3x3 = 1,
f_Sharpen_3x3 = 2,
f_Gaussian_Blur_5x5 = 3,
f_Sobel_0 = 4,
f_Sobel_1 = 5
};