1 module opencvd.cuda.imgroc;
2 
3 import opencvd.cuda.cudacore;
4 
5 private extern (C){
6     void GpuCvtColor(GpuMat src, GpuMat dst, int code);
7     void GpuThreshold(GpuMat src, GpuMat dst, double thresh, double maxval, int typ);
8 
9     CannyEdgeDetector CreateCannyEdgeDetector(double lowThresh, double highThresh, int appertureSize, bool L2gradient);
10     GpuMat CannyEdgeDetector_Detect(CannyEdgeDetector det, GpuMat img);
11     int CannyEdgeDetector_GetAppertureSize(CannyEdgeDetector det);
12     double CannyEdgeDetector_GetHighThreshold(CannyEdgeDetector det);
13     bool CannyEdgeDetector_GetL2Gradient(CannyEdgeDetector det);
14     double CannyEdgeDetector_GetLowThreshold(CannyEdgeDetector det);
15     void CannyEdgeDetector_SetAppertureSize(CannyEdgeDetector det, int appertureSize);
16     void CannyEdgeDetector_SetHighThreshold(CannyEdgeDetector det, double highThresh);
17     void CannyEdgeDetector_SetL2Gradient(CannyEdgeDetector det, bool L2gradient);
18     void CannyEdgeDetector_SetLowThreshold(CannyEdgeDetector det, double lowThresh);
19 }
20 
21 struct CannyEdgeDetector {
22     void* p;
23 
24     @disable this();
25 
26     static CannyEdgeDetector opCall(double lowThresh, double highThresh, int appertureSize, bool L2gradient){
27         return CreateCannyEdgeDetector(lowThresh, highThresh, appertureSize, L2gradient);
28     }
29 
30     GpuMat detect(GpuMat img){
31         return CannyEdgeDetector_Detect(this, img);
32     }
33 
34     int getAppertureSize(){
35         return CannyEdgeDetector_GetAppertureSize(this);
36     }
37 
38     double getHighThreshold(){
39         return CannyEdgeDetector_GetHighThreshold(this);
40     }
41 
42     bool getL2Gradient(){
43         return CannyEdgeDetector_GetL2Gradient(this);
44     }
45 
46     double getLowThreshold(){
47         return CannyEdgeDetector_GetLowThreshold(this);
48     }
49 
50     void setAppertureSize(int appertureSize){
51         CannyEdgeDetector_SetAppertureSize(this, appertureSize);
52     }
53 
54     void setHighThreshold(double highThresh){
55         CannyEdgeDetector_SetHighThreshold(this, highThresh);
56     }
57 
58     void setL2Gradient(bool L2gradient){
59         CannyEdgeDetector_SetL2Gradient(this, L2gradient);
60     }
61 
62     void setLowThreshold(double lowThresh){
63         CannyEdgeDetector_SetLowThreshold(this, lowThresh);
64     }
65 
66 }
67 
68 alias gpuCvtColor = GpuCvtColor;
69 alias gpuThreshold = GpuThreshold;
70