1
+ #ifndef _CPP_STITCHING_DETAIL_MATCHERS_H_
2
+ #define _CPP_STITCHING_DETAIL_MATCHERS_H_
3
+
4
+ #include " include_opencv.h"
5
+ using namespace cv ::detail;
6
+
7
+ void extractImageFeatures (
8
+ const ImageFeatures &f,
9
+ int *img_idx,
10
+ cv::Size *img_size,
11
+ std::vector<cv::KeyPoint> *keypoints,
12
+ cv::Mat *descriptors)
13
+ {
14
+ *img_idx = f.img_idx ;
15
+ *img_size = f.img_size ;
16
+ std::copy (f.keypoints .begin (), f.keypoints .end (), std::back_inserter (*keypoints));
17
+ f.descriptors .copyTo (*descriptors);
18
+ }
19
+
20
+ // ImageFeatures
21
+
22
+ CVAPI (int ) stitching_ImageFeatures_img_idx(ImageFeatures *obj)
23
+ {
24
+ return obj->img_idx ;
25
+ }
26
+ CVAPI (CvSize) stitching_ImageFeatures_img_size(ImageFeatures *obj)
27
+ {
28
+ return obj->img_size ;
29
+ }
30
+ CVAPI (int64) stitching_ImageFeatures_keypoints_size(ImageFeatures *obj)
31
+ {
32
+ return static_cast <int64>(obj->keypoints .size ());
33
+ }
34
+ CVAPI (void ) stitching_ImageFeatures_keypoints_copy(ImageFeatures *obj, cv::KeyPoint* outArray)
35
+ {
36
+ for (size_t i = 0 ; i < obj->keypoints .size (); i++)
37
+ {
38
+ outArray[i] = obj->keypoints [i];
39
+ }
40
+ }
41
+ CVAPI (void ) stitching_ImageFeatures_descriptors(ImageFeatures *obj, cv::Mat *outMat)
42
+ {
43
+ (obj->descriptors ).copyTo (*outMat);
44
+ }
45
+
46
+
47
+ // SurfFeaturesFinder
48
+
49
+ CVAPI (SurfFeaturesFinder*) stitching_SurfFeaturesFinder_new(
50
+ double hess_thresh, int num_octaves, int num_layers, int num_octaves_descr, int num_layers_descr)
51
+ {
52
+ return new SurfFeaturesFinder (hess_thresh, num_octaves, num_layers, num_octaves_descr, num_layers_descr);
53
+ }
54
+ CVAPI (void ) stitching_SurfFeaturesFinder_delete(SurfFeaturesFinder* obj)
55
+ {
56
+ delete obj;
57
+ }
58
+
59
+ CVAPI (void ) stitching_SurfFeaturesFinder_run1(
60
+ SurfFeaturesFinder* obj, cv::Mat *image,
61
+ int *img_idx, cv::Size *img_size, std::vector<cv::KeyPoint> *keypoints, cv::Mat *descriptors)
62
+ {
63
+ ImageFeatures features;
64
+ (*obj)(*image, features);
65
+ extractImageFeatures (features, img_idx, img_size, keypoints, descriptors);
66
+ }
67
+ CVAPI (void ) stitching_SurfFeaturesFinder_run2(
68
+ SurfFeaturesFinder* obj, cv::Mat *image, cv::Rect *rois, int roisSize,
69
+ int *img_idx, cv::Size *img_size, std::vector<cv::KeyPoint> *keypoints, cv::Mat *descriptors)
70
+ {
71
+ std::vector<cv::Rect> roisVec (rois, rois + roisSize);
72
+ ImageFeatures features;
73
+ (*obj)(*image, features, roisVec);
74
+ extractImageFeatures (features, img_idx, img_size, keypoints, descriptors);
75
+ }
76
+ CVAPI (void ) stitching_SurfFeaturesFinder_collectGarbage(SurfFeaturesFinder* obj)
77
+ {
78
+ obj->collectGarbage ();
79
+ }
80
+
81
+
82
+ // OrbFeaturesFinder
83
+
84
+ CVAPI (OrbFeaturesFinder*) stitching_OrbFeaturesFinder_new(
85
+ CvSize grid_size, int nfeatures, float scaleFactor, int nlevels)
86
+ {
87
+ return new OrbFeaturesFinder (grid_size, nfeatures, scaleFactor, nlevels);
88
+ }
89
+ CVAPI (void ) stitching_OrbFeaturesFinder_delete(OrbFeaturesFinder* obj)
90
+ {
91
+ delete obj;
92
+ }
93
+
94
+ CVAPI (void ) stitching_OrbFeaturesFinder_run1(
95
+ OrbFeaturesFinder* obj, cv::Mat *image,
96
+ int *img_idx, cv::Size *img_size, std::vector<cv::KeyPoint> *keypoints, cv::Mat *descriptors)
97
+ {
98
+ ImageFeatures features;
99
+ (*obj)(*image, features);
100
+ extractImageFeatures (features, img_idx, img_size, keypoints, descriptors);
101
+ }
102
+ CVAPI (void ) stitching_OrbFeaturesFinder_run2(
103
+ OrbFeaturesFinder* obj, cv::Mat *image, cv::Rect *rois, int roisSize,
104
+ int *img_idx, cv::Size *img_size, std::vector<cv::KeyPoint> *keypoints, cv::Mat *descriptors)
105
+ {
106
+ std::vector<cv::Rect> roisVec (rois, rois + roisSize);
107
+ ImageFeatures features;
108
+ (*obj)(*image, features, roisVec);
109
+ extractImageFeatures (features, img_idx, img_size, keypoints, descriptors);
110
+ }
111
+ CVAPI (void ) stitching_OrbFeaturesFinder_collectGarbage(OrbFeaturesFinder* obj)
112
+ {
113
+ obj->collectGarbage ();
114
+ }
115
+
116
+
117
+
118
+ #endif
0 commit comments