Xavier OpenCV4 cudaimgproc.hpp

I have used SDK manager to configure/install the Jetson Xavier AGX, and have OpenCV version 4.1.1 installed.

This is the cmake file using for my C++ codes:

cmake_minimum_required (VERSION 3.0)

set(CMAKE_CXX_STANDARD 17)

project(xiapi_test_1)

find_package(OpenCV REQUIRED)

include_directories("/usr/include/opencv4/")

add_executable(xiapi_test_1 xiapi_test_1.cpp)

target_link_libraries(xiapi_test_1 ${OpenCV_LIBS} -lm3api)

cmake, make and most of my C++ codes work, with cv::demosaicing. But when try to use the cuda assisted function cv::cuda::demosaicing, getting this error:

fatal error: opencv2/cudaimgproc.hpp: No such file or directory
#include <opencv2/cudaimgproc.hpp>
compilation terminated.

please note that opencv2/cudaimgproc.hpp is the required library for cv::cuda::demosaicing

When I check the usr/include/opencv4/opencv2 folder see this:

no cudaimgproc.hpp file exist??

is this normal, or am I making a mistake?

IF your application needs CUDA supported OpenCV, you should build OpenCV by yourself.
OpenCV 4.1.1 installed by SDK manager may not support CUDA.
To figure out:

$ python3
>> import cv2
>> print(cv2.getBuildInformation())

Find CUDA is enabled.

2 Likes

Hi,
You may run this script to build OpenCV:
JEP/install_opencv4.5.0_Jetson.sh at master · AastaNV/JEP · GitHub

@MtHiker thanks for giving quick explanation.

1 Like

ty for the reply. i get this one:

General configuration for OpenCV 4.1.1 =====================================
Version control: 4.1.1-2-gd5a58aa75

Platform:
Timestamp: 2019-12-13T17:25:11Z
Host: Linux 4.9.140-tegra aarch64
CMake: 3.10.2
CMake generator: Unix Makefiles
CMake build tool: /usr/bin/make
Configuration: Release

CPU/HW features:
Baseline: NEON FP16
required: NEON
disabled: VFPV3

C/C++:
Built as dynamic libs?: YES
C++ Compiler: /usr/bin/c++ (ver 7.4.0)
C++ flags (Release): -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Winit-self -Wsuggest-override -Wno-delete-non-virtual-dtor -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections -fvisibility=hidden -fvisibility-inlines-hidden -O3 -DNDEBUG -DNDEBUG
C++ flags (Debug): -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Winit-self -Wsuggest-override -Wno-delete-non-virtual-dtor -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections -fvisibility=hidden -fvisibility-inlines-hidden -g -O0 -DDEBUG -D_DEBUG
C Compiler: /usr/bin/cc
C flags (Release): -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wuninitialized -Winit-self -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections -fvisibility=hidden -O3 -DNDEBUG -DNDEBUG
C flags (Debug): -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wuninitialized -Winit-self -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections -fvisibility=hidden -g -O0 -DDEBUG -D_DEBUG
Linker flags (Release): -Wl,–gc-sections
Linker flags (Debug): -Wl,–gc-sections
ccache: NO
Precompiled headers: NO
Extra dependencies: dl m pthread rt
3rdparty dependencies:

OpenCV modules:
To be built: calib3d core dnn features2d flann gapi highgui imgcodecs imgproc ml objdetect photo python2 python3 stitching ts video videoio
Disabled: world
Disabled by dependency: -
Unavailable: java js
Applications: tests perf_tests examples apps
Documentation: NO
Non-free algorithms: NO

GUI:
GTK+: YES (ver 2.24.32)
GThread : YES (ver 2.56.4)
GtkGlExt: NO

Media I/O:
ZLib: /usr/lib/aarch64-linux-gnu/libz.so (ver 1.2.11)
JPEG: /usr/lib/aarch64-linux-gnu/libjpeg.so (ver 80)
WEBP: build (ver encoder: 0x020e)
PNG: /usr/lib/aarch64-linux-gnu/libpng.so (ver 1.6.34)
TIFF: /usr/lib/aarch64-linux-gnu/libtiff.so (ver 42 / 4.0.9)
JPEG 2000: build (ver 1.900.1)
HDR: YES
SUNRASTER: YES
PXM: YES
PFM: YES

Video I/O:
FFMPEG: YES
avcodec: YES (57.107.100)
avformat: YES (57.83.100)
avutil: YES (55.78.100)
swscale: YES (4.8.100)
avresample: NO
GStreamer: YES (1.14.5)
v4l/v4l2: YES (linux/videodev2.h)

Parallel framework: TBB (ver 2017.0 interface 9107)

Trace: YES (with Intel ITT)

Other third-party libraries:
Lapack: NO
Eigen: YES (ver 3.3.4)
Custom HAL: YES (carotene (ver 0.0.1))
Protobuf: build (3.5.1)

Python 2:
Interpreter: /usr/bin/python2.7 (ver 2.7.15)
Libraries: /usr/lib/aarch64-linux-gnu/libpython2.7.so (ver 2.7.15+)
numpy: /usr/lib/python2.7/dist-packages/numpy/core/include (ver 1.13.3)
install path: lib/python2.7/dist-packages/cv2/python-2.7

Python 3:
Interpreter: /usr/bin/python3 (ver 3.6.9)
Libraries: /usr/lib/aarch64-linux-gnu/libpython3.6m.so (ver 3.6.9)
numpy: /usr/lib/python3/dist-packages/numpy/core/include (ver 1.13.3)
install path: lib/python3.6/dist-packages/cv2/python-3.6

Python (for build): /usr/bin/python2.7

Java:
ant: NO
JNI: NO
Java wrappers: NO
Java tests: NO

Install to: /usr

how can i get the cuda info from here?

As your configuration, CUDA is not enabled.
Following is captured at my Jetson Nano:


Other third-party libraries:
Lapack: NO
Eigen: YES (ver 3.3.4)
Custom HAL: YES (carotene (ver 0.0.1))
Protobuf: build (3.5.1)

NVIDIA CUDA: YES (ver 10.2, CUFFT CUBLAS FAST_MATH)
NVIDIA GPU arch: 53 62 72
NVIDIA PTX archs:

cuDNN: YES (ver 8.0)

Try that @DaneLL guides what to do.

1 Like

Yours and DaneLLL’s suggestions solved my issue. Thanks a lot to you. Wish I could select your both’s answers as solution.

One last question: Should I use cv::cuda::GpuMat Class to fully enhance the power of the GPU on image processing problems?

Back in the days, when using TX2 or TK1, I had heard that cv::Mat Class was modified for Jetsons to also use the GPU’s power. Was it true? If so, did things changed for Xavier?

Hi,

No, it is not true. cv::Mat is CPU buffer. For GPU buffer, please use cv::cuda::GpuMat to utilize CUDA filters.

1 Like

Ty, gpumat is working now. All my issues are solved :)