main.cpp
1 | #include <iostream> |
---|---|
2 | |
3 | #include "opencv2/core/core.hpp" |
4 | #include "opencv2/features2d/features2d.hpp" |
5 | #include "opencv2/highgui/highgui.hpp" |
6 | |
7 | using namespace std; |
8 | using namespace cv; |
9 | using namespace cv::gpu; |
10 | |
11 | class Body : public ParallelLoopBody |
12 | { |
13 | public:
|
14 | virtual void operator() (const Range& range) const |
15 | { |
16 | for (int i = range.start; i < range.end; ++i) |
17 | { |
18 | Mat img = Mat::zeros(1000, 1000, CV_8U); |
19 | img(Rect(500,500,20,20)) = 255; |
20 | |
21 | vector<KeyPoint> kp; |
22 | |
23 | Ptr<FeatureDetector> detector = FeatureDetector::create("BRISK");
|
24 | |
25 | detector->set("thres", 6); |
26 | detector->detect(img, kp); |
27 | |
28 | cout << i << endl; |
29 | } |
30 | } |
31 | }; |
32 | |
33 | int main()
|
34 | { |
35 | initModule_features2d(); |
36 | |
37 | Body body; |
38 | parallel_for_(Range(0, 500), body); |
39 | |
40 | return 0; |
41 | } |