I use Yolo for object detection in darknet.
Enviroment info
Ubuntu 20.04
ROS noetic
GPU Jetson xavier NX
Camera ZED
CUDA 11.4
openCV 4.2.0
ZED DSK 3.8.2(for jetpack 5.0)
Two terminals, each with
roslaunch darknet_ros darknet_ros yolo_v3.launch
and
roslaunch zed_wrapper zed.launch
were executed.
Then the darknet_ros terminal gave a Gtk-ERROR.
Gtk-ERROR **: 04:28:17.451: GTK+ 2.x symbols detected. Using GTK+ 2.x and GTK+ 3 in the same process is not supported
enter image description here
I used this link to resolve the conflict between openCV and matplotlib, but it did not solve the problem.
Gtk-ERROR **: GTK+ 2.x symbols detected
Node
/zed/zed_node/rgb_raw/image_raw_color
of the ZED is available on darknet_ros.
How can I resolve GTK errors and perform object detection?
Thanks
Related
I am using conda virtual environment on Ubuntu 20.04 and I got this error while using "make" in Darknet folder even if my virtual environment(conda) has Opencv installed.
Here is the screenshot of the error:
Here is that cv2 is working and its version(4.5.5):
Here is the environment variables for CUDA and Opencv I used (in .bashrc):
Thanks in advance for your any help!
It seems that the problem is originated from not building OpenCV as Darknet needs.
As #ChristophRackwitz implied, showing python version worked is not enough to build darknet with OpenCV capability. To be able to build darknet with OpenCV ON, OpenCV should be built with C++ functionalities as some of instructions might be followed:
Instruction 1
Instruction 2
and so on.
I am writing a ROS node which uses OpenCV and SIFT (ROS Noetic, Ubuntu 20.04).
As of OpenCV version 4, the SIFT algorithm is part of the opencv_contrib package.
Within my ROS node, I want to use the ROS package cv_bridge, to convert between the OpenCV image format and ROS image sensor messages.
My understanding is that
Code in the opencv_contrib package is only usable if such package is built together with OpenCV from source.
cv_bridge depends on the Ubuntu package version of OpenCV, libopencv-dev.
I currently have both installed (the Ubuntu package and the version compiled from source) and I am trying to have my node depend on the source-compiled one, in order to use the non-free algorithms.
My procedure in order to do this is (after compiling OpenCV with the additional modules and OPENCV_ENABLE_NONFREE=ON) adding to the CMakeLists.txt of my package the following lines:
find_package(OpenCV PATHS .../opencv-4.5.4/cmake)
include_directories(include ${catkin_INCLUDE_DIRS} .../opencv-4.5.4/include)
link_directories(.../opencv-4.5.4/lib)
add_executable(...)
target_link_libraries(nodeName ${catkin_LIBRARIES} .../opencv-4.5.4/lib)
in order to link my code to the compiled version of OpenCV. However, when I try to build it with catkin build I obtain:
In file included from [...]:
[...]/markerDetection.h:8:10: fatal error: opencv2/xfeatures2d.hpp: No such file or directory
8 | #include <opencv2/xfeatures2d.hpp>
I suspect that ROS is trying to link to the version I installed through the package manager, which in fact does not have the opencv2/xfeatures2d.hpp library.
Am I setting the wrong options in CMakeLists.txt? Is what I am trying to do even possible?
I'have trained yolo-tiny-v4 on colab and the detection works well on colab.
Then I've tried to load the yolo-tiny-v4 in this way on visual studio integrated with Gazebo/ROS:
No error appears, but the detection fails (no object detected, the output of the detection is a vector of Nan).
I'm using OpenCV Version: 4.2.0 and Python 2.7.17 in visual studio.
Any idea?
Try compiling OpenCV >= v4.5.0 from sources.
Compiling version 4.5.0 from sources solved the issue for me in Python 3 and I checked it also works in Python 2.7.
I initially got the same issue with Yolo Tiny v4 and Python 3.7, both on Raspberry Pi 4 and Windows 7, with OpenCV installed via pip install opencv-contrib-python (seems not available for Python 2.7 ?).
I tried different versions iteratively, got from pip or recompiled from sources (latest version available via pip on Raspbian was 4.1.0.25):
opencv-contrib-python==3.4.10.37 no detections (tested on Windows)
opencv-contrib-python==4.1.0.25: no detections (tested on Rasbian Buster and Windows)
opencv-contrib-python==4.2.0.34: no detections (tested on Windows)
opencv-contrib-python==4.3.0.38: no detections (tested on Windows)
opencv 4.4.0 compiled from sources: no detections (tested on Rasbian Buster)
opencv-contrib-python==4.4.0.40: ok (tested on Windows)
opencv-contrib-python==4.4.0.46: ok (testd on Windows)
opencv 4.5.0 compiled from sources: ok (tested on Rasbian Buster)
Versions a little after opencv-contrib-python==4.4.0.40 seemed to works, so the "next" version available on Raspbian at the time was v4.5.0 from sources.
If I want to use my computer's GPU with OpenCV, is it necessary that I build OpenCV from source with CUDA enabled? Or can I install OpenCV with CUDA support via apt-get? I noticed the following 2 packages in apt-get:
libopencv-gpu-dev - development files for libopencv-gpu2.4v5
libopencv-gpu2.4v5 - computer vision GPU library
But I am not sure if these will work with OpenCV3 or if they are only compatible with OpenCV2. I know that the gpu module in Opencv2 was split up into multiple CUDA modules in OpenCV3.
Yes it is necessary that you build opencv from the source with CUDA option enabled. The apt-get packages won't work with OpenCV3 and above versions. I suggest you install the CUDA Toolkit first and then attempt installation of OpenCV or the GPU functions won't work.
Having Gstreamer 1.22 successfully installed I'm not able to configure the project to build OpenCV. CMake isn't able to find GStreamer on my machine. Any ideas how two address this issue?
Just found the solution:
Cmake is using FindGstreamerWindows.cmake to find GStreamer on Windows, which is using internal an environment variable called "GSTREAMER_DIR" pointing to ..\gstreamer\1.0\x86_64.
Please make sure GSTREAMER_DIR exists on your machine.
I recently compile Opencv 4.2 with GStreamer on Windows. I use settings for GStreamer as on the following pictures. Make sure you point to correct .lib and include directories. all_Library is gstapp-1.0.lib etc, when configuraing CMAKE to compile OpenCV.
I use Opencv 4.2, CMake 3.17.0 release candidate and Gstreamer 1.16.2 MSVC 64-bit (VS 2019) developer and runtime installer. The whole process is described here install OpenCV on windows GStreamer tutorial
The important part is to set up environmental variables to find Gstreamer Runtime. Into system variable path: add
xxx\1.0\x86_64\bin
xxx\1.0\x86_64\lib
xxx\1.0\x86_64\lib\gstreamer-1.0
Gstreamer pipe from c++ opencv program to the web.