0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

libuvcのインストールと使用方法

Posted at

#環境
ubuntu18.04
ROS melodic

#使い方

webカメラを接続した上で、下記コマンドを各ターミナルで実行

roscore
rosrun libuvc_camera camera_node
rosrun image_view image_view image:=/image_raw

#liuvcのインストール

apt-getでインストール

sudo apt-get install ros-melodic-libuvc-camera

もしくは、githubからインストール

mkdir libuvc
git clone https://github.com/ktossell/libuvc
cd libuvc
mkdir build
cd build
cmake ..
make && sudo make install

実行

rosrun libuvc_camera camera_node

#エラーが出た場合

上のコマンドで下記のエラーが出た場合

/opt/ros/melodic/lib/libuvc_camera/camera_node: error while loading shared libraries: libuvc.so: cannot open shared object file: No such file or directory

上記サイトより

Your library is a dynamic library.
You need to tell the operating system where it can locate it at runtime.
To do so, we will need to do those easy steps:

[1] Find where the library is placed if you don't know it.
sudo find / -name libuvc.so

/usr/local/lib/x86_64-linux-gnu/libuvc.so
find: ‘/proc/1429/task/1429/net’: 無効な引数です
find: ‘/proc/1429/net’: 無効な引数です
/home/okubo18/workspace/libuvc/libuvc/build/libuvc.so
/opt/ros/melodic/lib/x86_64-linux-gnu/libuvc.so
find: ‘/run/user/1000/gvfs’: 許可がありません

[2] Check for the existence of the dynamic library path environment variable(LD_LIBRARY_PATH)
echo $LD_LIBRARY_PATH

/home/okubo18/workspace/vins-fusion_ws/devel/lib:/home/okubo18/workspace/catkin_ws/devel/lib:/opt/ros/melodic/lib

[3] We add the desire path, export it and try the application.

LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib/x86_64-linux-gnu/
echo $LD_LIBRARY_PATH

/home/okubo18/workspace/vins-fusion_ws/devel/lib:/home/okubo18/workspace/catkin_ws/devel/lib:/opt/ros/melodic/lib:/usr/local/lib:/usr/local/lib/x86_64-linux-gnu/
※usr/local/lib も加えた

export LD_LIBRARY_PATH
rosrun libuvc_camera camera_node

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?