forked from hybridgroup/gocv
-
Notifications
You must be signed in to change notification settings - Fork 0
/
photo.cpp
86 lines (68 loc) · 2.88 KB
/
photo.cpp
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
#include "photo.h"
void ColorChange(Mat src, Mat mask, Mat dst, float red_mul, float green_mul, float blue_mul) {
cv::colorChange(*src, *mask, *dst, red_mul, green_mul, blue_mul);
}
void IlluminationChange(Mat src, Mat mask, Mat dst, float alpha, float beta) {
cv::illuminationChange(*src, *mask, *dst, alpha, beta);
}
void SeamlessClone(Mat src, Mat dst, Mat mask, Point p, Mat blend, int flags) {
cv::Point pt(p.x, p.y);
cv::seamlessClone(*src, *dst, *mask, pt, *blend, flags);
}
void TextureFlattening(Mat src, Mat mask, Mat dst, float low_threshold, float high_threshold, int kernel_size) {
cv::textureFlattening(*src, *mask, *dst, low_threshold, high_threshold, kernel_size);
}
void FastNlMeansDenoisingColoredMulti( struct Mats src, Mat dst, int imgToDenoiseIndex, int temporalWindowSize){
std::vector<cv::Mat> images;
for (int i = 0; i < src.length; ++i) {
images.push_back(*src.mats[i]);
}
cv::fastNlMeansDenoisingColoredMulti( images, *dst, imgToDenoiseIndex, temporalWindowSize );
}
void FastNlMeansDenoisingColoredMultiWithParams( struct Mats src, Mat dst, int imgToDenoiseIndex, int temporalWindowSize, float h, float hColor, int templateWindowSize, int searchWindowSize ){
std::vector<cv::Mat> images;
for (int i = 0; i < src.length; ++i) {
images.push_back(*src.mats[i]);
}
cv::fastNlMeansDenoisingColoredMulti( images, *dst, imgToDenoiseIndex, temporalWindowSize, h, hColor, templateWindowSize, searchWindowSize );
}
MergeMertens MergeMertens_Create() {
return new cv::Ptr<cv::MergeMertens>(cv::createMergeMertens());
}
MergeMertens MergeMertens_CreateWithParams(float contrast_weight,
float saturation_weight,
float exposure_weight) {
return new cv::Ptr<cv::MergeMertens>(cv::createMergeMertens(
contrast_weight, saturation_weight, exposure_weight));
}
void MergeMertens_Close(MergeMertens b) {
delete b;
}
void MergeMertens_Process(MergeMertens b, struct Mats src, Mat dst) {
std::vector<cv::Mat> images;
for (int i = 0; i < src.length; ++i) {
images.push_back(*src.mats[i]);
}
(*b)->process(images, *dst);
}
AlignMTB AlignMTB_Create() {
return new cv::Ptr<cv::AlignMTB>(cv::createAlignMTB(6,4,false));
}
AlignMTB AlignMTB_CreateWithParams(int max_bits, int exclude_range, bool cut) {
return new cv::Ptr<cv::AlignMTB>(
cv::createAlignMTB(max_bits, exclude_range, cut));
}
void AlignMTB_Close(AlignMTB b) { delete b; }
void AlignMTB_Process(AlignMTB b, struct Mats src, struct Mats *dst) {
std::vector<cv::Mat> srcMats;
for (int i = 0; i < src.length; ++i) {
srcMats.push_back(*src.mats[i]);
}
std::vector<cv::Mat> dstMats;
(*b)->process(srcMats, dstMats);
dst->mats = new Mat[dstMats.size()];
for (size_t i = 0; i < dstMats.size() ; ++i) {
dst->mats[i] = new cv::Mat( dstMats[i] );
}
dst->length = (int)dstMats.size();
}