PoseCNN: sh make.sh fatal error: opencv2/opencv.hpp: No such file or directory

Hello,

If i do sh make.sh I’m getting the following error:

hough_voting_gpu_op.cc:24:30: fatal error: opencv2/opencv.hpp: No such file or directory
 #include "opencv2/opencv.hpp"
                              ^
compilation terminated.
hough_voting_gpu_layer
In file included from Hypothesis.cpp:28:0:
Hypothesis.h:31:30: fatal error: opencv2/opencv.hpp: No such file or directory
 #include <opencv2/opencv.hpp>
                              ^
compilation terminated.
g++: error: Hypothesis.o: No such file or directory
hough_voting_layer

but: build computing label layer

So is this the normal behavior or did i miss something? I dont think so, but how can i resolve that?

I installed opencv with pip:

opencv-contrib-python         3.4.4.19 
opencv-python                 3.4.4.19 
gcc (Ubuntu 4.8.5-4ubuntu2) 4.8.5
g++ (Ubuntu 4.8.5-4ubuntu2) 4.8.5

After that I get with: ./experiments/scripts/demo.sh $GPU_ID this error: /gpu:0 Traceback (most recent call last): File “./tools/demo.py”, line 118, in <module> from networks.factory import get_network File “/home/nils/test/PoseCNN/tools/…/lib/networks/init.py”, line 8, in <module> from .vgg16 import vgg16 File “/home/nils/test/PoseCNN/tools/…/lib/networks/vgg16.py”, line 2, in <module> from networks.network import Network File “/home/nils/test/PoseCNN/tools/…/lib/networks/network.py”, line 17, in <module> import hough_voting_layer.hough_voting_op as hough_voting_op File “/home/nils/test/PoseCNN/tools/…/lib/hough_voting_layer/hough_voting_op.py”, line 5, in <module> _hough_voting_module = tf.load_op_library(filename) File “/home/nils/test/local/lib/python2.7/site-packages/tensorflow/python/framework/load_library.py”, line 56, in load_op_library lib_handle = py_tf.TF_LoadLibrary(library_filename) tensorflow.python.framework.errors_impl.NotFoundError: /home/nils/test/PoseCNN/tools/…/lib/hough_voting_layer/hough_voting.so: cannot open shared object file: No such file or directory

Kinect_fusion build succesfully, if i build synthesize:

(test) nils@Nils-Desktop-U:~/test/PoseCNN/lib/synthesize/build$ cmake … – OpenCV ARCH: – OpenCV RUNTIME: – OpenCV STATIC: ON CMake Warning at /home/nils/test/lib/python2.7/site-packages/cv2/OpenCVConfig.cmake:166 (message): Found OpenCV Windows Pack but it has no binaries compatible with your configuration.

You should manually point CMake variable OpenCV_DIR to your build of OpenCV library. Call Stack (most recent call first): CMakeLists.txt:28 (find_package)

CMake Error at CMakeLists.txt:28 (find_package): Found package configuration file:

/home/nils/test/lib/python2.7/site-packages/cv2/OpenCVConfig.cmake

but it set OpenCV_FOUND to FALSE so package “OpenCV” is considered to be NOT FOUND.

– Configuring incomplete, errors occurred! See also “/home/nils/test/PoseCNN/lib/synthesize/build/CMakeFiles/CMakeOutput.log”. See also “/home/nils/test/PoseCNN/lib/synthesize/build/CMakeFiles/CMakeError.log”.

Thx for your help.

About this issue

Most upvoted comments

I fixed this Problem with: sudo apt-get install libopencv-dev But is there another solution for virtualenv with pip ?

Installation guide for beginners!

IMPORTANT! MORE OTHER IMFORMATIONS FROM Kaju-Bubanja MAYBE HERE: https://github.com/Kaju-Bubanja/PoseCNN/tree/docu_updated

I didnt trained it i only used it 1 time. Atm I’m trying to use the new CNN also from Xiang from here: https://github.com/NVlabs/Deep_Object_Pose I used: Cuda 9.0 with a Patch, Cuddn 7.0, tensorflow-gpu 1.8 (from Source!), Ubuntu 16.04

utor from PoseCNN: yuxng commented on May 30 I used ubuntu 16.04, tensorflow 1.5.0, and cuda 9.1 https://github.com/yuxng/PoseCNN/issues/13

#------------------------------------------------------------------------------------------------------------------ #-OPENCV------------------------------------------------------------------------------------------------------- #Important install opencv! #Pip installation not working for me… ex: pip install opencv-python sudo apt-get install libopencv-dev

#------------------------------------------------------------------------------------------------------------------ #Set up the: virtualenv ----------------------------------------------------------------------------------------- #URL: https://wiki.ubuntuusers.com/virtualenv/ -------------------------------------------------------------- #------------------------------------------------------------------------------------------------------------------ sudo apt-get install virtualenv

virtualenv /home/USER/python-test

#Always in a new terminal or after restart! source /home/USER/python-test/bin/activate

#------------------------------------------------------------------------------------------------------------------ #–PIP env installations------------------------------------------------------------------------------------------ #------------------------------------------------------------------------------------------------------------------ #IMPORTANT! INSTALL MOCK GLOBALLY?! #DUNNO Why only worked for me this way. #You can try it first in the virtuelenv if it fails and asks for mock just isntall it globally! pip install mock pip install matplotlib numpy keras Cython Pillow easydict transforms3d sudo apt-get install libsuitesparse-dev OpenEXR libopenexr-dev metis libmetis-dev

#------------------------------------------------------------------------------------------------------------------ #------------Tensorflow------------------------------------------------------------------------------------------ #------------------------------------------------------------------------------------------------------------------ #IMPORTANT!! PIP INSTALL IS NOT working for me or other persons from github for posecnn #pip install tensorflow-gpu==1.8 #Install Pip from Source!! #–PIP env installations----------------------------------------- #Download the TensorFlow source code #Use Git to clone the TensorFlow repository:

#important not enum! install enum34! pip install enum34

git clone https://github.com/tensorflow/tensorflow.git cd tensorflow

#The repo defaults to the master development branch. You can also checkout a release branch to build: git checkout branch_name # r1.9, r1.10, etc.

#To test your copy of the source tree, run the following test for versions r1.12 and before (this may take a #while): bazel test -c opt – //tensorflow/… -//tensorflow/compiler/… -//tensorflow/contrib/lite/…

#For versions after r1.12 (like master), run the following: bazel test -c opt – //tensorflow/… -//tensorflow/compiler/… -//tensorflow/lite/…

#after: ./configure

#TF from source: https://www.tensorflow.org/install/source bazel build --config=opt --config=cuda //tensorflow/tools/pip_package:build_pip_package

#Bazel build options #Building TensorFlow from source can use a lot of RAM. If your system is memory-constrained, limit Bazel’s #RAM usage with: --local_resources 2048,.5,1.0.

#The official TensorFlow packages are built with GCC 4 and use the older ABI. #For GCC 5 and later, make your #build compatible with the older ABI using: --cxxopt=“-D_GLIBCXX_USE_CXX11_ABI=0”. #ABI compatibility ensures #that custom ops built against the official TensorFlow package continue to work with the GCC 5 built package.

#Build the package #The bazel build command creates an executable named build_pip_package—this is the program that #builds the pip package. For example, the following builds a .whl package in the /tmp/#tensorflow_pkg directory:

./bazel-bin/tensorflow/tools/pip_package/build_pip_package /tmp/tensorflow_pkg

pip install /tmp/tensorflow_pkg/tensorflow-1.8.0-cp27-cp27mu-linux_x86_64.whl

#thats it !

#------------------------------------------------------------------------------------------------------------------ #-ROS------------------------------------------------------------------------------------------------------------ #------------------------------------------------------------------------------------------------------------------ #Install ROS kinetic, than you have :

sudo sh -c ‘echo “deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main” > /etc/apt/sources.list.d/ros-latest.list’

sudo apt-key adv --keyserver hkp://ha.pool.sks-keyservers.net:80 --recv-key 421C365BD9FF1F717815A3895523BAEEB01FA116

sudo apt-get update

sudo apt-get install ros-kinetic-desktop-full

apt-cache search ros-kinetic

sudo rosdep init rosdep update

echo “source /opt/ros/kinetic/setup.bash” >> ~/.bashrc source ~/.bashrc

sudo apt install python-rosinstall python-rosinstall-generator python-wstool build-essential

#------------------------------------------------------------------------------------------------------------------ #-Change GCC and G+±--------------------------------------------------------------------------------------- #------------------------------------------------------------------------------------------------------------------ #Important! Change the gcc and g++ back if you are not using PoseCNN or installing different things!!!

sudo apt-get install gcc-4.8 sudo apt-get install g+±4.8

sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 10 sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-5 30

sudo update-alternatives --config gcc #change to 4.8! so it should be 1

sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g+±4.8 10 sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g+±5 30

sudo update-alternatives --config g++ #change to 4.8! so it should be 1

#Now test it with: gcc --version g++ --version

#------------------------------------------------------------------------------------------------------------------ #-Eigen----------------------------------------------------------------------------------------------------------- #------------------------------------------------------------------------------------------------------------------

wget https://bitbucket.org/eigen/eigen/get/3.3.0.zip extract 3.3.0.zip rename to eigen rm 3.3.0.zip cd eigen mkdir build && cd build cmake … make sudo make install

#------------------------------------------------------------------------------------------------------------------ #—Nanoflann--------------------------------------------------------------------------------------------------- #------------------------------------------------------------------------------------------------------------------ #Compile lib/kinect_fusion to be able to compile lib/synthesize.

#-Add nanoflann to the include dirs in cmake and sohpus to the include and link dirs #https://github.com/jlblancoc/nanoflann/commit/ad7547f4e6beb1cdb3e360912fd2e352ef959465 #https://github.com/jlblancoc/nanoflann/tree/ad7547f4e6beb1cdb3e360912fd2e352ef959465 #https://github.com/jlblancoc/nanoflann/archive/ad7547f4e6beb1cdb3e360912fd2e352ef959465.zip #57 nanoflann installation:

wget https://github.com/jlblancoc/nanoflann/archive/ad7547f4e6beb1cdb3e360912fd2e352ef959465.zip

extrakt ad7547f4e6beb1cdb3e360912fd2e352ef959465.zip rename nanoflann-ad7547f4e6beb1cdb3e360912fd2e352ef959465 nanoflann rm ad7547f4e6beb1cdb3e360912fd2e352ef959465.zip

sudo apt-get install build-essential cmake libgtest-dev libeigen3-dev #maybe not necesesary if you isntalled eigen from source already? cd nanoflann mkdir build && cd build && cmake … make && make test sudo make install

#------------------------------------------------------------------------------------------------------------------ #—Pangolin----------------------------------------------------------------------------------------------------- #------------------------------------------------------------------------------------------------------------------ #-If Pangolin is already installed, reinstall Pangolin, since it will be pointing at the old eigen which has the cuda bug mentioned here: https://devtalk.nvidia.com/default/topic/1026622/ #cuda-programming-and-performance/nvcc-can-t-compile-code-that-uses-eigen/

wget https://github.com/stevenlovegrove/Pangolin/archive/1ec721d59ff6b799b9c24b8817f3b7ad2c929b83.zip extrakt 1ec721d59ff6b799b9c24b8817f3b7ad2c929b83.zip rn Pangolin-1ec721d59ff6b799b9c24b8817f3b7ad2c929b83 Pangolin rm 1ec721d59ff6b799b9c24b8817f3b7ad2c929b83.zip

#Required Dependencies #C++11 #OpenGL (Desktop / ES / ES2) #Glew

(deb) sudo apt-get install libglew-dev

sudo apt-get install libglew-dev

#CMake (for build environment)

(deb) sudo apt-get install cmake

sudo apt-get install cmake

#Recommended Dependencies #Python2 / Python3, for drop-down interactive console #(deb) sudo apt-get install libpython2.7-dev #sudo apt-get install libpython2.7-dev #(for pybind11) git submodule init && git submodule update #(useful modules) sudo python -mpip install numpy pyopengl Pillow pybind11

#Optional Dependencies for video input #FFMPEG (For video decoding and image rescaling) #(deb) sudo apt-get install ffmpeg libavcodec-dev libavutil-dev libavformat-dev libswscale-dev libavdevice-dev sudo apt-get install ffmpeg libavcodec-dev libavutil-dev libavformat-dev libswscale-dev libavdevice-dev

#DC1394 (For firewire input) sudo apt-get install libdc1394-22-dev libraw1394-dev

#libuvc (For cross-platform webcam video input via libusb) #git://github.com/ktossell/libuvc.git

#libjpeg, libpng, libtiff, libopenexr (For reading still-image sequences) sudo apt-get install libjpeg-dev libpng12-dev libtiff5-dev libopenexr-dev

#OpenNI / OpenNI2 (For Kinect / Xtrion / Primesense capture)

#DepthSense SDK #Very Optional Dependencies #Eigen / TooN (These matrix types supported in the Pangolin API.) #CUDA Toolkit >= 3.2 (Some CUDA header-only interop utilities included) #http://developer.nvidia.com/cuda-downloads

#Doxygen for generating html / pdf documentation. sudo apt-get install doxygen doxygen-doc doxygen-gui graphviz

cd Pangolin #Add folowing line to the CMakeLists.txt add_definitions(-D_GLIBCXX_USE_CXX11_ABI=0) #beause of error: https://github.com/yuxng/DA-RNN/issues/7

mkdir build cd build cmake … cmake --build .

#If you would like to build the documentation and you have Doxygen installed, you can execute: cmake --build . --target doc

#------------------------------------------------------------------------------------------------------------------ #—Boost-------------------------------------------------------------------------------------------------------- #------------------------------------------------------------------------------------------------------------------ #Dunno how to install Boost, maybe you know it. wget https://dl.bintray.com/boostorg/release/1.67.0/source/boost_1_67_0.tar.bz2 extract boost_1_67_0.tar.bz2 rm boost_1_67_0.tar.bz2

#------------------------------------------------------------------------------------------------------------------ #—Sophus------------------------------------------------------------------------------------------------------ #------------------------------------------------------------------------------------------------------------------ wget https://github.com/strasdat/Sophus/archive/ceb6380a1584b300e687feeeea8799353d48859f.zip rm ceb6380a1584b300e687feeeea8799353d48859f.zip rn Sophus-ceb6380a1584b300e687feeeea8799353d48859f Sophus cd Sophus mkdir build && cd build cmake … make sudo make install

#------------------------------------------------------------------------------------------------------------------ #—NLOPT------------------------------------------------------------------------------------------------------- #------------------------------------------------------------------------------------------------------------------ wget https://github.com/stevengj/nlopt/archive/74e647b667f7c4500cdb4f37653e59c29deb9ee2.zip extract 74e647b667f7c4500cdb4f37653e59c29deb9ee2.zip rm 74e647b667f7c4500cdb4f37653e59c29deb9ee2.zip rename nlopt-74e647b667f7c4500cdb4f37653e59c29deb9ee2 nlopt cd nlopt mkdir build cd build cmake … make sudo make install

#------------------------------------------------------------------------------------------------------------------ #-CLONSE POSECNN-------------------------------------------------------------------------------------------- #------------------------------------------------------------------------------------------------------------------ git clone https://github.com/Kaju-Bubanja/PoseCNN.git cd PoseCNN/lib

#Building #Build kinect_fusion

#Shell cd kinect_fusion mkdir build cd build cmake … make # cd .. #Build synthesize #Shell cd synthesize mkdir build cd build cmake … make #```

#-Running the demo-------------------------------------------------------------------------------------------- #Download our trained model on the YCB-Video dataset from here, and save it to $ROOT/data/demo_models. #run the following script

./experiments/scripts/demo.sh #It will automatically use gpuid 0! #OR ./experiments/scripts/demo.sh --gpuid 0 #Spaces are important!

#-Running on the YCB-Video dataset-------------------------------------------------------------------------- #Download the YCB-Video dataset from here. #Create a symlink for the YCB-Video dataset (the name LOV is due to legacy, Learning Objects from Videos)

cd $ROOT/data/LOV ln -s $ycb_data data ln -s $ycb_models models

#Training and testing on the YCB-Video dataset cd $ROOT

#training ./experiments/scripts/lov_color_2d_train.sh $GPU_ID

#testing ./experiments/scripts/lov_color_2d_test.sh $GPU_ID

#------------------------------------------------------------------------------------------------------------------#My pip list aid output form my env folder: ------------------------------------------------------------------- #------------------------------------------------------------------------------------------------------------------

#Package Version
#------------------------------ --------- #absl-py 0.6.1
#actionlib 1.11.13
#angles 1.9.11
#astor 0.7.1
#backports.weakref 1.0.post1 #bleach 1.5.0
#bondpy 1.8.3
#camera-calibration 1.12.23
#camera-calibration-parsers 1.11.13
#catkin 0.7.14
#cv-bridge 1.12.8
#Cython 0.29.1
#diagnostic-analysis 1.9.3
#diagnostic-common-diagnostics 1.9.3
#diagnostic-updater 1.9.3
#dynamic-reconfigure 1.5.50
#easydict 1.9
#enum34 1.1.6
#funcsigs 1.0.2
#futures 3.2.0
#gast 0.2.0
#gazebo-plugins 2.5.17
#gazebo-ros 2.5.17
#gencpp 0.6.0
#geneus 2.2.6
#genlisp 0.4.16
#genmsg 0.5.11
#gennodejs 2.0.1
#genpy 0.6.7
#grpcio 1.16.1
#h5py 2.8.0
#html5lib 0.9999999 #image-geometry 1.12.8
#interactive-markers 1.11.4
#Keras 2.2.4
#Keras-Applications 1.0.6
#Keras-Preprocessing 1.0.5
#laser-geometry 1.6.4
#Markdown 3.0.1
#message-filters 1.12.14
#mock 2.0.0
#numpy 1.15.4
#OpenEXR 1.3.2
#pbr 5.1.1
#Pillow 5.3.0
#pip 18.1
#pkg-resources 0.0.0
#pluginlib 1.11.3
#protobuf 3.6.1
#python-qt-binding 0.3.4
#PyYAML 3.13
#qt-dotgraph 0.3.11
#qt-gui 0.3.11
#qt-gui-cpp 0.3.11
#qt-gui-py-common 0.3.11
#resource-retriever 1.12.4
#rosbag 1.12.14
#rosboost-cfg 1.14.4
#rosclean 1.14.4
#roscreate 1.14.4
#rosgraph 1.12.14
#roslaunch 1.12.14
#roslib 1.14.4
#roslint 0.11.0
#roslz4 1.12.14
#rosmake 1.14.4
#rosmaster 1.12.14
#rosmsg 1.12.14
#rosnode 1.12.14
#rosparam 1.12.14
#rospy 1.12.14
#rosservice 1.12.14
#rostest 1.12.14
#rostopic 1.12.14
#rosunit 1.14.4
#roswtf 1.12.14
#rqt-action 0.4.9
#rqt-bag 0.4.12
#rqt-bag-plugins 0.4.12
#rqt-console 0.4.8
#rqt-dep 0.4.9
#rqt-graph 0.4.9
#rqt-gui 0.5.0
#rqt-gui-py 0.5.0
#rqt-image-view 0.4.13
#rqt-launch 0.4.8
#rqt-logger-level 0.4.8
#rqt-moveit 0.5.7
#rqt-msg 0.4.8
#rqt-nav-view 0.5.7
#rqt-plot 0.4.8
#rqt-pose-view 0.5.8
#rqt-publisher 0.4.8
#rqt-py-common 0.5.0
#rqt-py-console 0.4.8
#rqt-reconfigure 0.4.10
#rqt-robot-dashboard 0.5.7
#rqt-robot-monitor 0.5.8
#rqt-robot-steering 0.5.9
#rqt-runtime-monitor 0.5.7
#rqt-rviz 0.5.10
#rqt-service-caller 0.4.8
#rqt-shell 0.4.9
#rqt-srv 0.4.8
#rqt-tf-tree 0.5.8
#rqt-top 0.4.8
#rqt-topic 0.4.10
#rqt-web 0.4.8
#rviz 1.12.16
#scipy 1.1.0
#sensor-msgs 1.12.7
#setuptools 40.6.3
#six 1.11.0
#smach 2.0.1
#smach-ros 2.0.1
#smclib 1.8.3
#termcolor 1.1.0
#tf 1.11.9
#tf-conversions 1.11.9
#tf2-geometry-msgs 0.5.20
#tf2-kdl 0.5.20
#tf2-py 0.5.20
#tf2-ros 0.5.20
#topic-tools 1.12.14
#transforms3d 0.3.1
#Werkzeug 0.14.1
#wheel 0.32.3
#xacro 1.11.3