forked from hybridgroup/gocv
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathimgproc.cpp
119 lines (96 loc) · 3.68 KB
/
imgproc.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
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
#include "../core.h"
#include "imgproc.h"
#include <string.h>
void GpuCvtColor(GpuMat src, GpuMat dst, int code, Stream s) {
if (s == NULL) {
cv::cuda::cvtColor(*src, *dst, code);
return;
}
cv::cuda::cvtColor(*src, *dst, code, 0, *s);
}
CannyEdgeDetector CreateCannyEdgeDetector(double lowThresh, double highThresh) {
return new cv::Ptr<cv::cuda::CannyEdgeDetector>(cv::cuda::createCannyEdgeDetector(lowThresh, highThresh));
}
CannyEdgeDetector CreateCannyEdgeDetectorWithParams(double lowThresh, double highThresh, int appertureSize, bool L2gradient) {
return new cv::Ptr<cv::cuda::CannyEdgeDetector>(cv::cuda::createCannyEdgeDetector(lowThresh, highThresh, appertureSize, L2gradient));
}
void CannyEdgeDetector_Close(CannyEdgeDetector det) {
delete det;
}
void CannyEdgeDetector_Detect(CannyEdgeDetector det, GpuMat img, GpuMat dst, Stream s) {
if (s == NULL) {
(*det)->detect(*img, *dst);
} else {
(*det)->detect(*img, *dst, *s);
}
return;
}
int CannyEdgeDetector_GetAppertureSize(CannyEdgeDetector det) {
return int((*det)->getAppertureSize());
}
double CannyEdgeDetector_GetHighThreshold(CannyEdgeDetector det) {
return double((*det)->getHighThreshold());
}
bool CannyEdgeDetector_GetL2Gradient(CannyEdgeDetector det) {
return bool((*det)->getL2Gradient());
}
double CannyEdgeDetector_GetLowThreshold(CannyEdgeDetector det) {
return double((*det)->getLowThreshold());
}
void CannyEdgeDetector_SetAppertureSize(CannyEdgeDetector det, int appertureSize) {
(*det)->setAppertureSize(appertureSize);
}
void CannyEdgeDetector_SetHighThreshold(CannyEdgeDetector det, double highThresh) {
(*det)->setHighThreshold(highThresh);
}
void CannyEdgeDetector_SetL2Gradient(CannyEdgeDetector det, bool L2gradient) {
(*det)->setL2Gradient(L2gradient);
}
void CannyEdgeDetector_SetLowThreshold(CannyEdgeDetector det, double lowThresh) {
(*det)->setLowThreshold(lowThresh);
}
HoughLinesDetector HoughLinesDetector_Create(double rho, double theta, int threshold) {
return new cv::Ptr<cv::cuda::HoughLinesDetector>(cv::cuda::createHoughLinesDetector(rho, theta, threshold));
}
HoughLinesDetector HoughLinesDetector_CreateWithParams(double rho, double theta, int threshold, bool sort, int maxlines) {
return new cv::Ptr<cv::cuda::HoughLinesDetector>(cv::cuda::createHoughLinesDetector(rho, theta, threshold, sort, maxlines));
}
void HoughLinesDetector_Close(HoughLinesDetector hld) {
delete hld;
}
void HoughLinesDetector_Detect(HoughLinesDetector hld, GpuMat img, GpuMat dst, Stream s) {
if (s == NULL) {
(*hld)->detect(*img, *dst);
} else {
(*hld)->detect(*img, *dst, *s);
}
return;
}
HoughSegmentDetector HoughSegmentDetector_Create(double rho, double theta, int minLineLength, int maxLineGap) {
return new cv::Ptr<cv::cuda::HoughSegmentDetector>(cv::cuda::createHoughSegmentDetector(rho, theta, minLineLength, maxLineGap));
}
void HoughSegmentDetector_Close(HoughSegmentDetector hsd) {
delete hsd;
}
void HoughSegmentDetector_Detect(HoughSegmentDetector hsd, GpuMat img, GpuMat dst, Stream s) {
if (s == NULL) {
(*hsd)->detect(*img, *dst);
} else {
(*hsd)->detect(*img, *dst, *s);
}
return;
}
TemplateMatching TemplateMatching_Create(int srcType, int method) {
return new cv::Ptr<cv::cuda::TemplateMatching>(cv::cuda::createTemplateMatching(srcType, method));
}
void TemplateMatching_Close(TemplateMatching tm) {
delete tm;
}
void TemplateMatching_Match(TemplateMatching tm, GpuMat img, GpuMat tmpl, GpuMat dst, Stream s) {
if (s == NULL) {
(*tm)->match(*img, *tmpl, *dst);
} else {
(*tm)->match(*img, *tmpl, *dst, *s);
}
return;
}