Imagenet-camera.cpp libraries not working on jetson nano

Hello,

I Have bought a jetson nano. I have cloned this:

I am trying to use this:

but when I execute this command:

g++ imagenet-camera.cpp

it prints that libraries are missing. After two days searching and testing I found this:
https://github.com/dusty-nv/jetson-video
I cloned it but the paths to the libraries are wrong… so again imagenet-camera.cpp prints errors. I cannot change 50 .h files to fix the paths inside. What should I do? Has anyone this problem? I am using a USB-webcam…

Thank you…

Hi,

You can find the building command in this page:
https://github.com/dusty-nv/jetson-inference/blob/master/docs/building-repo.md

The process should like this:

$ sudo apt-get install git cmake
$ git clone https://github.com/dusty-nv/jetson-inference
$ cd jetson-inference
$ git submodule update --init
$ mkdir build
$ cd build
$ cmake ../

Thanks.

Hello,

I tried it, and everything went ok, but when I tried:

$ cd jetson-inference/build			# omit if pwd is already /build from above
$ make
$ sudo make install

as the tutorial, that you have posted suggests, I got a lot of errors…

I also tried the command:

$ g++ imagenet-camera.cpp

and again the same situation as before: errors…
What shoulld I do?

Thank you

Hi plaketas1, from above it looks like you missed the cmake …/ command before running make. After deleting your jetson-inference directory, try running this:

$ git clone https://github.com/dusty-nv/jetson-inference
$ cd jetson-inference
$ git submodule update --init
$ mkdir build
$ cd build
$ cmake ../     # important to run this cmake command before make
$ make 
$ sudo make install

If you get errors after following this, please post them here.

Hello,

After running

make

command I got around 200 pages of errors.
The last errors I got are depicted below:

/usr/include/c++/7/bits/ostream_insert.h:77:27: error: ‘streamsize’ has not been declared
        const _CharT* __s, streamsize __n)
                           ^~~~~~~~~~
/usr/include/c++/7/bits/ostream_insert.h: In function ‘std::basic_ostream<_CharT, _Traits>& std::__ostream_insert(std::basic_ostream<_CharT, _Traits>&, const _CharT*, int)’:
/usr/include/c++/7/bits/ostream_insert.h:87:14: error: ‘streamsize’ does not name a type; did you mean ‘streambuf’?
        const streamsize __w = __out.width();
              ^~~~~~~~~~
              streambuf
/usr/include/c++/7/bits/ostream_insert.h:88:12: error: ‘__w’ was not declared in this scope
        if (__w > __n)
            ^~~
/usr/include/c++/7/bits/ostream_insert.h:88:12: note: suggested alternative: ‘__s’
        if (__w > __n)
            ^~~
            __s
/usr/include/c++/7/bits/ostream_insert.h: At global scope:
/usr/include/c++/7/bits/ostream_insert.h:118:68: error: ‘streamsize’ has not been declared
   extern template ostream& __ostream_insert(ostream&, const char*, streamsize);
                                                                    ^~~~~~~~~~
/usr/include/c++/7/bits/ostream_insert.h:122:11: error: ‘streamsize’ has not been declared
           streamsize);
           ^~~~~~~~~~
In file included from /usr/include/c++/7/bits/range_access.h:36:0,
                 from /usr/include/c++/7/string:51,
                 from /home/nobody1/Desktop/jetson/jetson-inference/utils/camera/gstCamera.h:27,
                 from /home/nobody1/Desktop/jetson/jetson-inference/utils/camera/gstCamera.cpp:23:
/usr/include/c++/7/initializer_list:53:15: error: ‘size_t’ does not name a type; did you mean ‘time_t’?
       typedef size_t   size_type;
               ^~~~~~
               time_t
/usr/include/c++/7/initializer_list:59:7: error: ‘size_type’ does not name a type; did you mean ‘true_type’?
       size_type   _M_len;
       ^~~~~~~~~
       true_type
/usr/include/c++/7/initializer_list:62:54: error: ‘size_type’ has not been declared
       constexpr initializer_list(const_iterator __a, size_type __l)
                                                      ^~~~~~~~~
/usr/include/c++/7/initializer_list:70:17: error: ‘size_type’ does not name a type; did you mean ‘true_type’?
       constexpr size_type
                 ^~~~~~~~~
                 true_type
/usr/include/c++/7/initializer_list:47:11: fatal error: definition of std::initializer_list does not match #include <initializer_list>
     class initializer_list
           ^~~~~~~~~~~~~~~~
compilation terminated.
utils/CMakeFiles/jetson-utils.dir/build.make:259: recipe for target 'utils/CMakeFiles/jetson-utils.dir/camera/gstCamera.cpp.o' failed
make[2]: *** [utils/CMakeFiles/jetson-utils.dir/camera/gstCamera.cpp.o] Error 1
CMakeFiles/Makefile2:599: recipe for target 'utils/CMakeFiles/jetson-utils.dir/all' failed
make[1]: *** [utils/CMakeFiles/jetson-utils.dir/all] Error 2
Makefile:129: recipe for target 'all' failed
make: *** [all] Error 2

What should I do?

Thank you

It is hard to tell only from the last errors. Are you able to post the first errors? Also you may just want to try a fresh SD card image.

Below I attach more errors…

Thank you
errors.pdf (1.87 MB)

Can you try running these commands below?

$ sudo apt-get update
$ sudo apt-get install -y libqt4-dev qt4-dev-tools libglew-dev glew-utils libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libglib2.0-dev
$ sudo apt-get install -y libopencv-calib3d-dev libopencv-dev

Hello,

with the last command running I got this:

nobody1@nobody1-desktop:~$ sudo apt-get install -y libopencv-calib3d-dev libopencv-dev
Reading package lists... Done
Building dependency tree       
Reading state information... Done
libopencv-dev is already the newest version (3.3.1-2-g31ccdfe11).
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 libopencv-calib3d-dev : Depends: libopencv-features2d-dev (= 3.2.0+dfsg-4ubuntu0.1)
 libopencv-dev : Conflicts: libopencv-calib3d-dev
E: Unable to correct problems, you have held broken packages.

That may be OK, as you already have OpenCV installed.

Try running cmake …/ and then make again, and let me know if it outputs different errors than before.

Helloo,

I followed what you wrote in the #10 post. Here are the errors I got. What should I do?

Thank you…
errors2.pdf (1.87 MB)

It appears to be some problem with GStreamer, I am not sure why you encounter such issues. Are you sure these packages are installed?

sudo apt-get install libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libglib2.0-dev

If you keep having problems you should try a fresh SD card image, it seems there is a configuration issue with your current one.

For some reason the microSD card has 12 partitions…
I believe something wrong went on, here…

Thank you

That’s normal.

It’s because of how the nano boots. You can read more here.

https://docs.nvidia.com/jetson/l4t/index.html

At this point I think I would still recommend flashing a fresh SD card image, so we can establish a proper baseline here. Then follow these steps:

$ git clone https://github.com/dusty-nv/jetson-inference
$ cd jetson-inference
$ git submodule update --init
$ mkdir build
$ cd build
$ cmake ../     # important to run this cmake command before make
$ make 
$ sudo make install

Try building the repo as-is first, before attempting to make the DEFAULT_CAMERA modification for your USB camera.

I flashed the last version of nvidia-ubuntu and finally the above commnands worked. It says to change the DEFAULT_CAMERA and use the /dev/video… I don’t use Logitech C920. How do I find what to put there? How do I find the type of my webcamera?

Thank you a lot for your time…

Glad to hear that you got it compiling with the fresh image!

You should probably set DEFAULT_CAMERA to 0 unless you also have a MIPI CSI camera plugged in too (in that case set it to 1).

You can list your V4L2 devices and their supported formats/resolutions with the v4l2-ctl utility:

$ sudo apt-get install v4l-utils
$ v4l2-ctl --list-devices --list-formats
$ v4l2-ctl -d /dev/video0 --list-formats-ext
1 Like

Hello,

When I put DEFAULT_CAMERA to 0, I just save the .cpp file, I don’t do any compile again? Right? After running the commands 1 and 2 I get information about my camera, but when I execute:

./imagenet-camera googlenet

or

./imagenet-camera alexnet

I get a black screen…

Yes, after changing the DEFAULT_CAMERA, you need to compile again with make from your build/ directory. It shouldn’t need to re-build everything, just that file.

So the commands:

$ make 
$ sudo make install

?