In the institute we use Scientific Linux 5 on the cluster and I need to deploy an app that uses a modern OpenCV distribution (2.3.1 or 2.4.0). I don't have root privileges on the cluster.
Essentially, how do I package all the dynamic binary dependencies of ffmpeg (and hopefully x264), opencv so that I can xcopy-deploy my app?
I have a working installation of OpenCV 2.3.1 on Ubuntu. If there was a way to controllably load the executable and copy along all the dynamic dependencies, I could use it.
Thanks,
Vadim
You don't need to install OpenCV in the computers if you don't have permission to do so.
Place the OpenCV libraries and it's dependencies somewhere in the system and before you execute your application make sure you adjust LD_LIBRARY_PATH to add these paths.
To retrieve the list of dependencies of a certain binary application/library, use ldd. You might be interested in reading this post: Copying shared library dependencies
1) Install GCC 4.7.3
sudo apt-get update
sudo apt-get install build-essential
2) Install CMake 2.8.10.1
sudo apt-get install cmake cmake-curses-gui
3) Download OpenCV 2.4.5
cd ~/Downloads
tar -xf opencv-2.4.5.tar.gz
cd opencv-2.4.5
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Release ..
make -j4
sudo make install
cd ../..
rm -rf opencv-2.4.5*
OpenBR uses OpenCV for face recognition. A clear documentation is available to install OpenBR,Here's the link!
Related
I have a simple rust application which compiles without errors on my Ubuntu host machine.
The Cargo.toml looks like this:
[package]
name = "openvc-test"
version = "0.1.0"
edition = "2021"
[dependencies]
opencv = "0.66"
Then I tried to cross compile this project for armv7-unknown-linux-gnueabihf, so that I can run the binary on a raspberry. I used the cross tool for this purpose. The FAQ of the cross project has some information about how to handle external libraries. So I tried to install libopencv-dev:armhf on the docker image just like in the examples of the FAQ. However, I get the following error:
The following packages have unmet dependencies:
libopencv-dev:armhf : Depends: libopencv3.2-java:armhf (= 3.2.0+dfsg-6) but it is not installable
Recommends: opencv-data:armhf but it is not installable
I also tried to use Debian repositories as described in the FAQ. The error is the same.
Does anyone have an idea on how to solve this issue? Or is there another way of cross compiling a rust project that I can try?
Compiling on the raspberry does not work, compilation gets stuck at package opencv. I think it is due to the limited performance of the rapsberry?
Installing a precompiled opencv package in the docker container does not work (still don't know why), but cross compiling the correct opencv version does work. See the following docker file:
ARG CROSS_BASE_IMAGE
FROM $CROSS_BASE_IMAGE
# requirements of bindgen, see https://rust-lang.github.io/rust-bindgen/requirements.html
RUN DEBIAN_FRONTEND=noninteractive apt install -y llvm-dev libclang-dev clang
# cross compile opencv, see https://docs.opencv.org/4.x/d0/d76/tutorial_arm_crosscompile_with_cmake.html
RUN DEBIAN_FRONTEND=noninteractive apt install -y gcc-arm-linux-gnueabihf git build-essential cmake
RUN git clone --depth 1 --branch '4.5.1' https://github.com/opencv/opencv.git && \
cd opencv/platforms/linux && \
mkdir build && \
cd build && \
cmake -DCMAKE_TOOLCHAIN_FILE=../arm-gnueabi.toolchain.cmake ../../.. && \
make && \
make install
ENV CMAKE_PREFIX_PATH="/opencv/platforms/linux/build/install"
In Cross.toml you simply specify the path of the dockerfile, e.g.:
[target.armv7-unknown-linux-gnueabihf]
dockerfile = "./Dockerfile"
Cross compiling the Rust project:
cross build --target armv7-unknown-linux-gnueabihf
The initial setup of the docker container takes quite a long time.
I have opencv 3.4.1 installed from source on my ubuntu. But when running command catkin_make -DCMAKE_BUILD_TYPE=Release I get error:
No rule to make target '/usr/lib/x86_64-linux-gnu/libopencv_calib3d.so.3.2.0', needed by '~/ros_ws/devel/lib/stereo_slam/image_handle_node'. Stop.
No rule to make target '/usr/lib/x86_64-linux-gnu/libopencv_calib3d.so.3.2.0', needed by '~/ros_ws/devel/lib/libmetrics_lib.so'. Stop.
I've already tried following this: openCV program compile error "libopencv_core.so.2.4: cannot open shared object file: No such file or directory" in ubuntu 12.04
[EDIT] I get the same error compiling using clion or catkin_make directly from terminal, but clion creates special packages for release and debug versions. I don't quite understand these packages but in files CMakeCache.txt i found folowing lines:
//Dependencies for the target
metrics_lib_LIB_DEPENDS:STATIC=general;/opt/ros/melodic/lib/libtf.so;general;/opt/ros/melodic/lib/libtf2_ros.so;general;/opt/ros/melodic/lib/libactionlib.so;general;/opt/ros/melodic/lib/libmessage_filters.so;general;/opt/ros/melodic/lib/libtf2.so;general;/opt/ros/melodic/lib/libcv_bridge.so;general;/opt/ros/melodic/lib/libimage_geometry.so;general;/usr/lib/x86_64-linux-gnu/libopencv_calib3d.so.3.2.0;general;/usr/lib/x86_64-linux-gnu/libopencv_core.so.3.2.0;general;/usr/lib/x86_64-linux-gnu/libopencv_features2d.so.3.2.0;general;/usr/lib/x86_64-linux-gnu/libopencv_flann.so.3.2.0;general;/usr/lib/x86_64-linux-gnu/libopencv_highgui.so.3.2.0;general;/usr/lib/x86_64-linux-gnu/libopencv_imgcodecs.so.3.2.0;general;/usr/lib/x86_64-linux-gnu/libopencv_imgproc.so.3.2.0;general;/usr/lib/x86_64-linux-gnu/libopencv_ml.so.3.2.0;general;/usr/lib/x86_64-linux-gnu/libopencv_objdetect.so.3.2.0;general;/usr/lib/x86_64-linux-gnu/libopencv_photo.so.3.2.0;general;/usr/lib/x86_64-linux-gnu/libopencv_shape.so.3.2.0;general;/usr/lib/x86_64-linux-gnu/libopencv_stitching.so.3.2.0;general;/usr/lib/x86_64-linux-gnu/libopencv_superres.so.3.2.0;general;/usr/lib/x86_64-linux-gnu/libopencv_video.so.3.2.0;general;/usr/lib/x86_64-linux-gnu/libopencv_videoio.so.3.2.0;general;/usr/lib/x86_64-linux-gnu/libopencv_videostab.so.3.2.0;general;/usr/lib/x86_64-linux-gnu/libopencv_viz.so.3.2.0;general;/usr/lib/x86_64-linux-gnu/libopencv_aruco.so.3.2.0;general;/usr/lib/x86_64-linux-gnu/libopencv_bgsegm.so.3.2.0;general;/usr/lib/x86_64-linux-gnu/libopencv_bioinspired.so.3.2.0;general;/usr/lib/x86_64-linux-gnu/libopencv_ccalib.so.3.2.0;general;/usr/lib/x86_64-linux-gnu/libopencv_datasets.so.3.2.0;general;/usr/lib/x86_64-linux-gnu/libopencv_dpm.so.3.2.0;general;/usr/lib/x86_64-linux-gnu/libopencv_face.so.3.2.0;general;/usr/lib/x86_64-linux-gnu/libopencv_freetype.so.3.2.0;general;/usr/lib/x86_64-linux-gnu/libopencv_fuzzy.so.3.2.0;general;/usr/lib/x86_64-linux-gnu/libopencv_hdf.so.3.2.0;general;/usr/lib/x86_64-linux-gnu/libopencv_line_descriptor.so.3.2.0;general;/usr/lib/x86_64-linux-gnu/libopencv_optflow.so.3.2.0;general;/usr/lib/x86_64-linux-gnu/libopencv_phase_unwrapping.so.3.2.0;general;/usr/lib/x86_64-linux-gnu/libopencv_plot.so.3.2.0;general;/usr/lib/x86_64-linux-gnu/libopencv_reg.so.3.2.0;general;/usr/lib/x86_64-linux-gnu/libopencv_rgbd.so.3.2.0;general;/usr/lib/x86_64-linux-gnu/libopencv_saliency.so.3.2.0;general;/usr/lib/x86_64-linux-gnu/libopencv_stereo.so.3.2.0;general;/usr/lib/x86_64-linux-gnu/libopencv_structured_light.so.3.2.0;general;/usr/lib/x86_64-linux-gnu/libopencv_surface_matching.so.3.2.0;general;/usr/lib/x86_64-linux-gnu/libopencv_text.so.3.2.0;general;/usr/lib/x86_64-linux-gnu/libopencv_ximgproc.so.3.2.0;general;/usr/lib/x86_64-linux-gnu/libopencv_xobjdetect.so.3.2.0;general;/usr/lib/x86_64-linux-gnu/libopencv_xphoto.so.3.2.0;general;/opt/ros/melodic/lib/libroscpp.so;general;/usr/lib/x86_64-linux-gnu/libboost_filesystem.so;general;/usr/lib/x86_64-linux-gnu/libboost_signals.so;general;/opt/ros/melodic/lib/librosconsole.so;general;/opt/ros/melodic/lib/librosconsole_log4cxx.so;general;/opt/ros/melodic/lib/librosconsole_backend_interface.so;general;/usr/lib/x86_64-linux-gnu/liblog4cxx.so;general;/usr/lib/x86_64-linux-gnu/libboost_regex.so;general;/opt/ros/melodic/lib/libxmlrpcpp.so;general;/opt/ros/melodic/lib/libroscpp_serialization.so;general;/opt/ros/melodic/lib/librostime.so;general;/opt/ros/melodic/lib/libcpp_common.so;general;/usr/lib/x86_64-linux-gnu/libboost_system.so;general;/usr/lib/x86_64-linux-gnu/libboost_thread.so;general;/usr/lib/x86_64-linux-gnu/libboost_chrono.so;general;/usr/lib/x86_64-linux-gnu/libboost_date_time.so;general;/usr/lib/x86_64-linux-gnu/libboost_atomic.so;general;/usr/lib/x86_64-linux-gnu/libpthread.so;general;/usr/lib/x86_64-linux-gnu/libconsole_bridge.so.0.4;general;prometheus-cpp::core;general;prometheus-cpp::pull;general;ceres;general;proto;
I don't understand what these metrics_lib_LIB_DEPENDS are, and from where do they come from.
I also used erroneously sudo find / -name "opencv" -exec rm -i {} \; to remove opencv and I had the same problem.
I solved with :
sudo apt remove libopencv-dev
sudo apt remove libopencv-core3.2
However not all the opencv lib will be unistalled with this, so you need to remove all the opencv lib installed with ros (in my case I needed to remove also opencv-data). You can find them with:
sudo apt list --installed | grep opencv
after that you can install again ros melodic (or whatever you are using) :
sudo apt install ros-melodic-desktop-full
Problem was that I uninstalled previous version of opencv via next command:
sudo find / -name "*opencv*" -exec rm -i {} \;
By doing this I also erased the contents of the ROS OpenCV library. Later even after reinstalling ROS, these libraries did not reinstall because the system thinks they are installed but nothing was in them. I had to apt-get each library individually.
Don't purge OpenCV...
I'm trying installing Erlang on my REHL7.2, but unfortunately I failed. I tried two approaches
First I tried downloading a RPM package from official site of erlang (in fact the rpm package is for CentOS, but there's no RPM package for RHEL anyway), but
error: Failed dependencies:
libwx_baseu-2.8.so.0()(64bit) is needed by esl-erlang-19.0-1.x86_64
libwx_baseu-2.8.so.0(WXU_2.8)(64bit) is needed by esl-erlang-19.0-1.x86_64
Then I tried
$ wget http://packages.erlang-solutions.com/erlang-solutions-1.0-1.noarch.rpm
$ rpm -Uvh erlang-solutions-1.0-1.noarch.rpm
But it failed too because
No package erlang available.
Error: Nothing to do
I wonder whether Erlang is no longer supported by RHEL? Otherwise how can I install Erlang on my RHEL7.2?
One simple solution to install the Erlang Solutions package is install the epel repository:
yum install epel-release
Then
wget https://packages.erlang-solutions.com/erlang-solutions-1.0-1.noarch.rpm
rpm -Uvh erlang-solutions-1.0-1.noarch.rpm
sudo yum install erlang
The epel repo contains the libwx_* libraries required.
As instructed here:
enter link description here
Run the following commands (note: the commands on the above link use R15B01, but in the following commands, I changed it to the last release of Erlang (R15B03) It will take a while to finish with the installation. Run commands line by line
sudo yum install gcc glibc-devel make ncurses-devel openssl-devel autoconf
wget http://erlang.org/download/otp_src_R15B03.tar.gz
tar zxvf otp_src_R15B03.tar.gz
cd otp_src_R15B03
./configure && make && sudo make install
After everything is done, you will be still at otp_src_R15B03 where Erlang is installed. Type erl and Enter, then, it should run and open Erlang prompt. I tried running Erlang from my home directory and from the root by just typing erl and it worked too. This way, Erlang is working good for me. To quit Erlang press CTRL + g then q and Enter
There is another way to install and useful info on this link:
enter link description here
I have figured it out! I found two solutions.
The first solution which is also the easiest way is to install a zero dependency version of erlang, please refer to my another Question. But I only tried this way after installing erlang from source, so if you failed this way, just try the following soltuion.
The other one is to build erlang from source (or by kerl which is essentially the same thing).
Install necessary dependencies:$sudo yum install ncurses-devel openssl-devel *openjdk-devel unixODBC unixODBC-devel
Download source code of erlang, unzip it and cd into the direcotry
sudo ./configure sudo make sudo make install
Please refer to this article.
Thank you everyone!
Try this, worked for me.
wget http://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
rpm -ivh epel-release-latest-7.noarch.rpm
sudo yum install erlang erlang-nox
We are getting this error while installing ImageMagick PECL:
checking ImageMagick MagickWand API configuration program... found in
/usr/local/bin/MagickWand-config checking if ImageMagick version is at
least 6.2.4... found version 6.8.6 Q16 checking for MagickWand.h
header file... configure: error: Cannot locate header file
MagickWand.h ERROR: `/root/tmp/pear/imagick/configure --with-imagick'
failed extension imagick.so installed in /usr/local/lib/php.ini
/usr/local/bin/php does not have a php.ini Tidying
/usr/local/cpanel/3rdparty/php/53/etc/php.ini... No changes
Any idea how to fix this ?
This thread is old, but I solved this issue today on a Centos 7 by installing ImageMagick-devel package:
yum install ImageMagick-devel
Hope this helps.
Steps:
apt-get install libmagickwand-dev
/opt/lampp/bin/pecl install imagick
gedit /opt/lampp/etc/php.ini
add "extension=imagick.so" to php.ini
Probably its looking for the file MagickWand.h and unable to see that file in the defined location. Try these steps
wget http://pecl.php.net/get/imagick-3.1.0RC2.tgz
tar zxf imagick-3.1.0RC2.tgz
Edit the file imagick-3.1.0RC2/config.m4 line number 55.
Make changes like this, from
if test -r $WAND_DIR/include/ImageMagick/wand/MagickWand.h;
to
if test -r $WAND_DIR/include/ImageMagick-6/wand/MagickWand.h;
Note this difference made in the imagick version number. After that try the conventional installation procedures
cd imagick-3.1.0RC2
phpize
./configure
make
make install
Perhaps this http://thomas.bindzus.me/2013/08/11/building-pecl-imagick-for-php-5-5-1-on-centos-6-4/ can be of some help to others.
The solution described by Leo Prince almost worked for me, just had to set PKG_CONFIG_PATH, and perhaps that's just my server setup which isn't as perfect as it should be.
Here is what I did step-by-step (I'm running CentOS 6.4, Apache 2.4.6, and PHP 5.5.1):
wget http://pecl.php.net/get/imagick-3.1.0RC2.tgz
tar zxf imagick-3.1.0RC2.tgz
cd imagick-3.1.0RC
phpize
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
./configure –with-imagick
make
make install
echo extension=imagick.so > /etc/php.d/imagick.ini
service httpd restart
php -m | grep imagick
First run following commands
1. "WHM Home » Software » Rebuild RPM Database"
2. yum install ImageMagick ImageMagick-devel
3. yum install pcre-devel
Then go to
Go to WHM -> Software -> Module Installers -> PHP Pecl (manage). On the
box below “Install a PHP Pecl” enter “imagick” and click “Install Now”
button – that’s all. Restart Apache.
Above steps worked for me.
I already have OpenCV2.4.2 installed as part of ROS(Fuerte) in my computer(installed from Ubuntu Software Center, something due to ROS). How should I install OpenCV as a standalone?
I went through this guide and downloaded the opencv package from here. I am not quite clear as how to proceed. Can anyone give short list of steps to install? I want to use an IDE for my projects, so which IDE is proper for C++ and how to install the proper IDE and configure it correctly?
Also how to check if certain tools are installed?
This link which you also mentioned describes the necessary steps to compile OpenCV on your machine.
The version of OpenCV you install this way will be newer than the one installed with the ROS package, they usually have some delay. (Maybe not with Fuerte.)
Using multiple versions of the same library on a machine might cause problems with linking and it will create a bit of headache for you so I would avoid it.
Try running pkg-config opencv --libs to see if the ROS version pulled by Fuerte is available and you can use this with your projects later on.
For a starter IDE I would recommend Qt Creator.
The easy way to set OpenCV up with your project in Qt Creator is the following:
Create a project
Open the .pro file of the project
Run pkg-config opencv --cflags
Add this to the .pro file: INCLUDEPATH += __result__of__above
pkg-config opencv --libs
Add this to the .pro file: LIBS += __result__of__above
In the end what you add should look something like this:
INCLUDEPATH += -I/opt/ros/fuerte/include
LIBS += -L/opt/ros/fuerte/lib -lopencv_calib3d -lopencv_contrib -lopencv_core -lopencv_features2d -lopencv_flann -lopencv_gpu -lopencv_highgui -lopencv_imgproc -lopencv_legacy -lopencv_ml -lopencv_nonfree -lopencv_objdetect -lopencv_photo -lopencv_stitching -lopencv_ts -lopencv_video -lopencv_videostab
To install OpenCV using the terminal on Ubuntu:
$ su -
# apt-get update
# apt-get install build-essential
# apt-get install libavformat-dev
# apt-get install x264 v4l-utils ffmpeg
# apt-get install libcv2.3 libcvaux2.3 libhighgui2.3 python-opencv opencv-doc libcv-dev libcvaux-dev libhighgui-dev
OpenCV should be installed in /usr/local/ Installation Directory
You may also want to compile and view examples
$ cp -r /usr/share/doc/opencv-doc/examples .
$ cd examples
$ cd c
$ sh build_all.sh
You can read the complete article about How to install OpenCV on Ubuntu from Nam Huy Linux Blog at http://namhuy.net/1205/how-to-install-opencv-on-ubuntu.html
This github user has compiled all the installation steps using a shell script. You can install any OpenCV version you want by running the appropriate shell script inside.
$ git clone https://github.com/jayrambhia/Install-OpenCV.git
$ cd Ubuntu
$ chmod +x *
$ ./opencv_latest.sh
There is an installer for Ubuntu 16.04, and it may work well on Ubuntu 12.04, you could have a try. I have used it to install on Ubuntu 16.04 and it succeed!
An interactive installing script for install openCV on Ubuntu 16.04 LTS