GMS-Feature-Matcher
GMS-Feature-Matcher copied to clipboard
How to use GPU under Python
How to use GPU under Python ? Thanks.
its necessary compile your opencv with cuda cmake -D CMAKE_BUILD_TYPE=RELEASE
-D CMAKE_INSTALL_PREFIX=/usr/local
-D WITH_CUDA=ON
-D ENABLE_FAST_MATH=1
-D CUDA_FAST_MATH=1
-D WITH_CUBLAS=1
-D OPENCV_ENABLE_NONFREE=ON
-D INSTALL_PYTHON_EXAMPLES=ON
-D OPENCV_GENERATE_PKGCONFIG=ON
-D OPENCV_EXTRA_MODULES_PATH=~/opencv_build/opencv_contrib/modules
-D BUILD_EXAMPLES=ON .
change default matcher
matcher = cv2.BFMatcher(cv2.NORM_HAMMING)
for cuda matcher
matcher = cv2.cuda.DescriptorMatcher_createBFMatcher(cv2.NORM_HAMMING)
and it
all_matches = self.matcher.match(descriptors_image1, descriptors_image2)
for it
cuMatDesc2 = cv2.cuda_GpuMat()
cuMatDesc1.upload(descriptors_image1)
cuMatDesc2.upload(descriptors_image2)
all_matches = self.matcher.match(cuMatDesc1, cuMatDesc2)
thanks.
matcher = cv2.cuda.DescriptorMatcher_createBFMatcher(cv2.NORM_HAMMING)
AttributeError: 'module' object has no attribute 'DescriptorMatcher_createBFMatcher'
OpenCV 3.3.1
@Algabri try using OpenCV 4
https://docs.opencv.org/master/dd/dc5/classcv_1_1cuda_1_1DescriptorMatcher.html
I installed OpenCV 4.2, it is already run on GPU but I did not observe any differences between CPU and GPU. The same speed (Frame per second), it is running at 30 fps for whole image with 50000 points, but when I use it with deep learning, it made dropping the fps to 6 instead of 23 fps because of matching with every object instead of one (if deep learning only run is 23 fps and if GMS-Feature-Matcher only run is 30 fps)