Qengineering / Install-OpenCV-Jetson-Nano

OpenCV installation script with CUDA and cuDNN support
https://qengineering.eu/install-opencv-on-jetson-nano.html
BSD 3-Clause "New" or "Revised" License
137 stars 47 forks source link

Install on Conda Env #3

Closed ruhyadi closed 2 years ago

ruhyadi commented 2 years ago

I'm new to the world of Linux and Jetson Nano. How to do opencv build in anaconda environment ?. I have tried installation but opencv is not installed on anaconda env. I need an opencv build to enable GStreamer.

Qengineering commented 2 years ago

We never install OpenCV with an installer like anaconda because we want to keep control of every modules that are going to be installed. In addition (and more importantly) we as C++ programmers need the headers of the various OpenCV routines. Something you don't get with a pip3 install or sudo apt-get install. Since we use the same OpenCV version everywhere on the Jetson Nano, it doesn't matter to us whether it is installed system wide rather than in a virtual environment. In addition, virtual environments keep making new copies of OpenCV, which is sometimes not desirable on a small system like the Nano. You can now do three things. 1) Install OpenCV within a virtual environment (which you created earlier) with a sudo apt -get install libopencv-dev python3-opencv. Can only be used in Python 2) Install OpenCV according to our guide. You can read here how you can set this up in a virtual environment. You can still use Python now. 3) Install OpenCV with a script from this repo. Even now Python can still be used, but you have OpenCV system wide on your Nano instead of in a virtual environment

ruhyadi commented 2 years ago

Good advice. I've done the installation according to the guide you provided, and it's work like a charm. I symlink python3 library to virtual env (conda) and installation to /usr/local. It works fine even now that my opencv is integrated with conda. This is the screenshoot that my Nano can use Gstreamer. Untitled(15)

And this is the full cmake, that I build.

`General configuration for OpenCV 4.5.0 ===================================== Version control: unknown

Extra modules: Location (extra): /home/gamanet/opencv_contrib/modules Version control (extra): unknown

Platform: Timestamp: 2021-09-05T09:22:35Z Host: Linux 4.9.201-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++ standard: 11 C++ Compiler: /usr/bin/c++ (ver 7.5.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=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=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 -Wl,--as-needed
Linker flags (Debug): -Wl,--gc-sections -Wl,--as-needed
ccache: NO Precompiled headers: NO Extra dependencies: dl m pthread rt 3rdparty dependencies:

OpenCV modules: To be built: alphamat aruco bgsegm bioinspired calib3d ccalib core datasets dnn dnn_objdetect dnn_superres dpm face features2d flann freetype fuzzy gapi hdf hfs highgui img_hash imgcodecs imgproc intensity_transform line_descriptor mcc ml objdetect optflow phase_unwrapping photo plot python2 python3 quality rapid reg rgbd saliency sfm shape stereo stitching structured_light superres surface_matching text tracking ts video videoio videostab xfeatures2d ximgproc xobjdetect xphoto Disabled: world Disabled by dependency: - Unavailable: cnn_3dobj cudaarithm cudabgsegm cudacodec cudafeatures2d cudafilters cudaimgproc cudalegacy cudaobjdetect cudaoptflow cudastereo cudawarping cudev cvv java js julia matlab ovis viz Applications: tests perf_tests examples apps Documentation: NO Non-free algorithms: NO

GUI: GTK+: YES (ver 3.22.30) GThread : YES (ver 2.56.4) GtkGlExt: NO VTK support: 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: 0x020f) 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 2.3.1) OpenEXR: build (ver 2.3.0) HDR: YES SUNRASTER: YES PXM: YES PFM: YES

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

Parallel framework: pthreads

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)

OpenCL: YES (no extra features) Include path: /home/gamanet/opencv/3rdparty/include/opencl/1.2 Link libraries: Dynamic load

Python 2: Interpreter: /usr/bin/python2.7 (ver 2.7.17) Libraries: /usr/lib/aarch64-linux-gnu/libpython2.7.so (ver 2.7.17) 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: /home/gamanet/miniforge3/envs/vo3d/bin/python (ver 3.6.13) Libraries: /home/gamanet/miniforge3/envs/vo3d/lib/libpython3.6m.so (ver 3.6.13) numpy: /home/gamanet/miniforge3/envs/vo3d/lib/python3.6/site-packages/numpy/core/include (ver 1.19.5) install path: lib/python3.6/site-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/local -----------------------------------------------------------------