cyrusbehr / YOLOv8-TensorRT-CPP

YOLOv8 TensorRT C++ Implementation
MIT License
567 stars 69 forks source link

opencv2/cudaimgproc.hpp: No such file or directory #26

Closed HXB-1997 closed 1 year ago

HXB-1997 commented 1 year ago

(CUDA113+CUDNN82) han@han:~/Desktop/hxb_projects/CPP_Instance/10-31/git-2/YOLOv8-TensorRT-CPP/build$ make [ 8%] Building CXX object libs/tensorrt-cpp-api/CMakeFiles/tensorrt_cpp_api.dir/src/engine.cpp.o /home/han/Desktop/hxb_projects/CPP_Instance/10-31/git-2/YOLOv8-TensorRT-CPP/libs/tensorrt-cpp-api/src/engine.cpp:7:10: fatal error: opencv2/cudaimgproc.hpp: No such file or directory 7 | #include <opencv2/cudaimgproc.hpp> | ^~~~~~~~~~~~~~~~~~~~~~~~~ compilation terminated. make[2]: *** [libs/tensorrt-cpp-api/CMakeFiles/tensorrt_cpp_api.dir/build.make:76: libs/tensorrt-cpp-api/CMakeFiles/tensorrt_cpp_api.dir/src/engine.cpp.o] Error 1 make[1]: *** [CMakeFiles/Makefile2:215: libs/tensorrt-cpp-api/CMakeFiles/tensorrt_cpp_api.dir/all] Error 2 make: *** [Makefile:91: all] Error 2

YumainOB commented 1 year ago

Hello,

Looks like you are missing opencv_contib includes. How did you get opencv(build from sources or distributed packages)? If you want more help please provide some system informations and take a look at https://github.com/cyrusbehr/tensorrt-cpp-api/blob/main/scripts/build_opencv.sh it may help you solving what i think your issue may be.

Best regards

cyrusbehr commented 1 year ago

@YumainOB is correct. Please be sure to compile OpenCV with CUDA support. Follow the instructions in the readme file: image

If you confirm that you have compiled OpenCV with CUDA support and still have issues, please reopen this issue.

HXB-1997 commented 1 year ago

@cyrusbehr @YumainOB thank you so much. I'll have a try.

huynhkhoa44 commented 10 months ago

@HXB-1997 @cyrusbehr anyone have fixed this issue? I have tried both install opencv by another package and the script build_opencv.sh but I still have this issue.

cyrusbehr commented 10 months ago

@huynhkhoa44 can you provide more info on the issue you are facing. What is the error?

huynhkhoa44 commented 10 months ago

@cyrusbehr I want to use script build_opencv.sh. I follow the instruction and modify my path to CUDNN LIBRARY and CUDNN INCLUDE DIR. image

And I run this file image

And this is my error image

huynhkhoa44 commented 10 months ago

After error when use this code, I try to install opencv with CUDA by this link: https://www.youtube.com/watch?v=X6cXBqIz464. After install succesful, I build the project. But it has error like this issue when I run "make -j 8" image

cyrusbehr commented 10 months ago

@huynhkhoa44

Look at the screenshot you uploaded. Your OpenCV build script is failing:

image

You can't proceed with building the project until you first build OpenCV properly.

You probably need to modify these two arguments so that they point to the installation location of CUDNN on your system (I'm betting if you checked, those directories specified don't exist).

image

Find our where your CUDNN is installed to. Once you'd done that, update the CUDNN_INCLUDE_DIR and CUDNN_LIBRARY arguments and rebuild OpenCV. If the build script still fails, then we can try to work to solve the issue.