검색결과 리스트
글
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 | #include <iostream> #include <algorithm> #include <iomanip> #include <cmath> #include <vector> #include <queue> #include <limits> #include <string> #include <opencv2/core.hpp> #include <opencv2/imgproc.hpp> #include <opencv2/highgui.hpp> #include <opencv2/features2d.hpp> #include <opencv2/cudafeatures2d.hpp> #include <opencv2/core/cuda.hpp> #include <opencv2/cudafilters.hpp> #include <opencv2/cudaimgproc.hpp> #include <opencv2/cudawarping.hpp> using namespace cv; using namespace std; int main(int argc, char** argv) { while (1) { Mat frameMat01 = imread("frame01.jpg"); Mat frameMat02 = imread("frame02.jpg"); clock_t begin, end; begin = clock(); cuda::GpuMat cuFrameMat01, cuFrameMat02; cuFrameMat01.upload(frameMat01); cuFrameMat02.upload(frameMat02); cuda::cvtColor(cuFrameMat01, cuFrameMat01, CV_BGR2GRAY); cuda::cvtColor(cuFrameMat02, cuFrameMat02, CV_BGR2GRAY); Ptr<cuda::ORB> orb = cuda::ORB::create(1000, 1.2f, 8, 31, 0, 2, ORB::HARRIS_SCORE, 31, 20, false); cuda::GpuMat cuMask01(frameMat01.rows, frameMat01.cols, CV_8UC1, cv::Scalar::all(1)); //330,215 cuda::GpuMat cuMask02(frameMat02.rows, frameMat02.cols, CV_8UC1, cv::Scalar::all(1)); //315,235 cuda::GpuMat cuKeyPoints01, cuKeyPoints02; cuda::GpuMat cuDescriptors01, cuDescriptors02; orb->detectAndComputeAsync(cuFrameMat01, cuMask01, cuKeyPoints01, cuDescriptors01); orb->detectAndComputeAsync(cuFrameMat02, cuMask02, cuKeyPoints02, cuDescriptors02); Ptr<cuda::DescriptorMatcher> matcher = cv::cuda::DescriptorMatcher::createBFMatcher(cv::NORM_HAMMING); cuda::GpuMat gpuMatchesMat; matcher->knnMatchAsync(cuDescriptors01, cuDescriptors02, gpuMatchesMat, 2, noArray()); vector<vector<DMatch>> knnMatchesVec; waitKey(); } waitKey(0); return 0; } | cs |
'Computer > Coding' 카테고리의 다른 글
[opencv] OpenCV extra 모듈 cmake 빌드 (윈도우 환경) (1) | 2020.12.30 |
---|---|
std::String -> LPCSTR 변환 (0) | 2019.01.10 |
[opencv] Opencv + cuda 사용을 위한 CMake 빌드 (윈도우 환경) (1) | 2018.06.08 |
[Tensorflow] c++에서 이용가능한 그래프 만들기 (0) | 2018.05.15 |
[Tensorflow] Ubuntu 환경 c++ + 텐서플로 + opencv 빌드 (0) | 2018.05.15 |
RECENT COMMENT