简体   繁体   中英

OpenCV CUDA Function Missing - namespace "cv:cuda" has no member "resize"

I'm trying to use OpenCV 4.1 with CUDA 10 to resize lots of large tif stacks, but VS2017 doesn't see the function resize in the library. It's happy with a subset of the cv::cuda library, but doesn't see all the functions as listed here: https://docs.opencv.org/4.1.0/d1/d1a/namespacecv_1_1cuda.html

I'm including #include <opencv2/opencv.hpp> , and Intellisense shows me the autocompletes of cuda:: of PtrSz, registerPageLocked, resetDevice, setBufferPoolConfig , but no resize...?

I adapted the old OpenCV 3(?ish; here https://www.opencv-srf.com/p/introduction.html ) tutorial online to setup my VS project:

  1. Created a system level environment variable $(OPENCV_DIR) pointing to the OpenCV build folder
  2. In the Project properties I added:
    • All Configurations:
    • C/C++ -> General -> Additional Include Directories $(OPENCV_DIR)\\include
    • Linker -> General -> Additional LibraryDirectories $(OPENCV_DIR)\\x64\\vc15\\lib here, and below, I've changed the vc## folder to reflect that I'm using VS2017
    • Debugging -> Environment PATH=$(OPENCV_DIR)\\x64\\vc15\\bin;%PATH%
    • In Configuration Manager...
    • Set Active solution platform: to x64
    • Debug:
    • Linker -> Input -> Additional Dependencies opencv_world410d.lib
    • Release:
    • Linker -> Input -> Additional Dependencies opencv_world410.lib

If I try to compile using cv::cuda::resize(...) I get the compile error of namespace "cv::cuda" has not member "resize" . If instead I try to use one of the functions it sees in that namespace, eg std::cout << "CUDA device count: " << cuda::getCudaEnabledDeviceCount(); it outputs CUDA device count: 0 and trying something like std::cout << "CUDA device: " << cuda::getDevice(); gives the following error: OpenCV(4.1.0) Error: No CUDA support (The library is compiled without CUDA support) in throw_no_cuda, file c:\\build\\master_winpack-build-win64-vc15\\opencv\\modules\\core\\include\\opencv2\\core\\private.cuda.hpp, line 107

I'm confused, firstly, why it only sees a subset of the functions available in that cv::cuda namespace, and secondly, why I don't have CUDA support? Do I need to compile OpenCV on my machine first?

Make sure you are including the proper header files. In your case cudawarping.hpp should be the right one. Most likely you like to do some matrix arithmetic as well so you need to include cudaarithm.hpp .

#include <opencv2/cudaarithm.hpp>
#include "opencv2/cudawarping.hpp"

Here is the api documentation to resize: Documentation

Hope it helps...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM