Zed_yolo build error in c++

Hello,
I am not able to run the C++ YOLO example code for using ZED camera.
The ‘make’ process inside the build folder fails.

/home/dev/zed-yolo/zed_cpp_sample/src/main.cpp:18:10: fatal error: sl_zed/Camera.hpp: No such file or directory
 #include <sl_zed/Camera.hpp>
          ^~~~~~~~~~~~~~~~~~~
compilation terminated.
CMakeFiles/darknet_zed.dir/build.make:62: recipe for target 'CMakeFiles/darknet_zed.dir/src/main.o' failed
make[2]: *** [CMakeFiles/darknet_zed.dir/src/main.o] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/darknet_zed.dir/all' failed
make[1]: *** [CMakeFiles/darknet_zed.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2

I could not find the <sl_zed/Camera.hpp> header file.

I am working on a Jetson Nano with jetpack 4.6 and Cuda version 10.2 .
I have installed the ZED SDK version 3.7

Please help me with figuring out a solution.

NOTE:
I cloned the legacy branch of the github repository.

Thank you

Hello and thank you for reaching us out,

Where did you find your code sample ? There might be something wrong on it.
The include should be :

#include <sl/Camera.hpp>

The samples you’re mentioning are on our public github, and you can also use python if you’re more comfortable with it :
https://github.com/stereolabs/zed-examples/tree/master/object%20detection/custom%20detector

Regards
Antoine

Antoine Lassagne
Senior Developer - ZED SDK
Stereolabs Support

Hello
Thank you for your help. I have been able to make the changes by changing the library from <sl_zed/Camera.hpp> to <sl/Camera.hpp>. I had to make some code changes in the C++ code to make it work.

I want to be able to measure the distance of detected objects. The examples of object detection in the repo zed-examples are not having depth detection.

I took the code sample for Yolo object detection with depth measurement from the github link https://github.com/stereolabs/zed-yolo/tree/legacy

I was not able to build the “libdarknet” due to some CUDA error. So, I git cloned the AlexeyAB/darknet and build it and placed it in placed it in place of the “libdarknet”.

I am now getting the error as follows -

[ 50%] Linking CXX executable darknet_zed
/usr/bin/ld: cannot find -ldarknet
collect2: error: ld returned 1 exit status
CMakeFiles/darknet_zed.dir/build.make:164: recipe for target 'darknet_zed' failed
make[2]: *** [darknet_zed] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/darknet_zed.dir/all' failed
make[1]: *** [CMakeFiles/darknet_zed.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2

Hello again,
This repository seems very outdated, sorry for that.

Your error states that you are missing libraries. there are two things to try first :

  • Clean your build folder and run cmake again. Maybe it’s trying to build something from the cache which does not make sense.
  • Check CMakeLists.txt and verify that you have the libraries mentionned there.

If you don’t really know how to use CMake, this error might be hard to solve. If you have a guy who knows cmake next to you, it will take him a few minutes :slight_smile:

I also really advise you to take a look to https://github.com/stereolabs/zed-examples/tree/master/object%20detection/custom%20detector which is a much more recent implementation of YOLO (and a newer version too), in c++ and python.

Best regards
Antoine

Antoine Lassagne
Senior Developer - ZED SDK
Stereolabs Support

Hello,
Thank you for your suggestion.
The example at https://github.com/stereolabs/zed-examples/tree/master/object%20detection/custom%20detector is working great. But it only is for object detection using Yolo.

I also want to implement distance detection for detected objects as shown in the example https://www.stereolabs.com/docs/yolo/images/zed-yolo-3D.jpg. How can I implement that? Any help would be appreciated.

Thank you

Hi again,
Our SDK provide something like that. You can proceed like stated in the documentation : https://www.stereolabs.com/docs/object-detection/using-object-detection/#accessing-object-information

Best regards

Antoine Lassagne
Senior Developer - ZED SDK
Stereolabs Support

1 Like

Hi,
Thank you for your support.
I have written the codes for both Python and C++ for Yolov4 object detection and distance measurement using the Zed SDK and Zed 2 camera. I have made use of the OpenCV DNN module for detecting objects using the Yolov4 weights.

My code works just like the example shown here https://www.stereolabs.com/docs/yolo/images/zed-yolo-3D.jpg

Can I open a pull request in the “zed-yolo” repository to update it or in the “zed-examples” repository?

Thank you

Hello, you are very welcome to open a pull request indeed !

Bests

Antoine Lassagne
Senior Developer - ZED SDK
Stereolabs Support

Cordial greetings, I am starting to use the zed camera, and I am working in QtCreator.

I wanted to ask how to add this library in Linux and in this programming environment.

#include <sl/Camera.hpp>

Thank you for your attention.

Hi, you need to install ZED SDK.