Trying to run dnn module
I have installed Opencv 3.1.0 along with Opencv_contrib module with the aim of reading caffe models into Opencv. I followed the official Opencv installation documentation and with a change in Cmake command, I was able to build it successfully on Ubuntu 14.04lts.
When I type the following command to run the sample program -
g++ -o 1 ssd_object_detection.cpp `pkg-config --cflags --libs opencv`
I get the error below.
ssd_object_detection.cpp:1:27: fatal error: opencv2/dnn.hpp: No such file or directory
#include <opencv2/dnn.hpp>
^
compilation terminated.
I looked at the opencv_contrib github repo and they mentioned that you have to run it with a linker to the specific module which you want. So my command then became-
g++ -o 1 ssd_object_detection.cpp `pkg-config --cflags --libs opencv` -lopencv_dnn
But I still get the same error. Does this mean that my dnn module hasn't been built properly? The error is from the header file opencv2/dnn.hpp not being recognised but I don't know why?
The sample program is from this link- sample program to load caffe model and run
Output of cmake-
cmake -D CMAKE_BUILD_TYPE=Release -D OPENCV_EXTRA_MODULES=~/opt/opencv_contrib/modules -D CMAKE_INSTALL_PREFIX=/usr/local ..
-- The CXX compiler identification is GNU 4.8.4
-- The C compiler identification is GNU 4.8.4
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Detected version of GNU GCC: 48 (408)
-- Performing Test HAVE_CXX_FSIGNED_CHAR
-- Performing Test HAVE_CXX_FSIGNED_CHAR - Success
-- Performing Test HAVE_C_FSIGNED_CHAR
-- Performing Test HAVE_C_FSIGNED_CHAR - Success
-- Performing Test HAVE_CXX_W
-- Performing Test HAVE_CXX_W - Success
-- Performing Test HAVE_C_W
-- Performing Test HAVE_C_W - Success
-- Performing Test HAVE_CXX_WALL
-- Performing Test HAVE_CXX_WALL - Success
-- Performing Test HAVE_C_WALL
-- Performing Test HAVE_C_WALL - Success
-- Performing Test HAVE_CXX_WERROR_RETURN_TYPE
-- Performing Test HAVE_CXX_WERROR_RETURN_TYPE - Success
-- Performing Test HAVE_C_WERROR_RETURN_TYPE
-- Performing Test HAVE_C_WERROR_RETURN_TYPE - Success
-- Performing Test HAVE_CXX_WERROR_NON_VIRTUAL_DTOR
-- Performing Test HAVE_CXX_WERROR_NON_VIRTUAL_DTOR - Success
-- Performing Test HAVE_C_WERROR_NON_VIRTUAL_DTOR
-- Performing Test HAVE_C_WERROR_NON_VIRTUAL_DTOR - Success
-- Performing Test HAVE_CXX_WERROR_ADDRESS
-- Performing Test HAVE_CXX_WERROR_ADDRESS - Success
-- Performing Test HAVE_C_WERROR_ADDRESS
-- Performing Test HAVE_C_WERROR_ADDRESS - Success
-- Performing Test HAVE_CXX_WERROR_SEQUENCE_POINT
-- Performing Test HAVE_CXX_WERROR_SEQUENCE_POINT - Success
-- Performing Test HAVE_C_WERROR_SEQUENCE_POINT
-- Performing Test HAVE_C_WERROR_SEQUENCE_POINT - Success
-- Performing Test HAVE_CXX_WFORMAT
-- Performing Test HAVE_CXX_WFORMAT - Success
-- Performing Test HAVE_C_WFORMAT
-- Performing Test HAVE_C_WFORMAT - Success
-- Performing Test HAVE_CXX_WERROR_FORMAT_SECURITY
-- Performing Test HAVE_CXX_WERROR_FORMAT_SECURITY - Success
-- Performing Test HAVE_C_WERROR_FORMAT_SECURITY
-- Performing Test HAVE_C_WERROR_FORMAT_SECURITY - Success
-- Performing Test HAVE_CXX_WMISSING_DECLARATIONS
-- Performing Test HAVE_CXX_WMISSING_DECLARATIONS - Success
-- Performing Test HAVE_C_WMISSING_DECLARATIONS
-- Performing Test HAVE_C_WMISSING_DECLARATIONS - Success
-- Performing Test HAVE_CXX_WMISSING_PROTOTYPES
-- Performing Test HAVE_CXX_WMISSING_PROTOTYPES - Failed
-- Performing Test HAVE_C_WMISSING_PROTOTYPES
-- Performing Test HAVE_C_WMISSING_PROTOTYPES - Success
-- Performing Test HAVE_CXX_WSTRICT_PROTOTYPES
-- Performing Test HAVE_CXX_WSTRICT_PROTOTYPES - Failed
-- Performing Test HAVE_C_WSTRICT_PROTOTYPES
-- Performing Test HAVE_C_WSTRICT_PROTOTYPES - Success
-- Performing Test HAVE_CXX_WUNDEF
-- Performing Test HAVE_CXX_WUNDEF - Success
-- Performing Test HAVE_C_WUNDEF
-- Performing Test HAVE_C_WUNDEF - Success
-- Performing Test HAVE_CXX_WINIT_SELF
-- Performing Test HAVE_CXX_WINIT_SELF - Success
-- Performing Test HAVE_C_WINIT_SELF
-- Performing Test HAVE_C_WINIT_SELF - Success
-- Performing Test HAVE_CXX_WPOINTER_ARITH
-- Performing Test ...
make install
?pkg-config --cflags --libs opencv
say, when run standalone on cmdliine ?Hi berak,
pkg-config --cflags --libs opencv
command, there is no mention of dnn module.in that case, can you try to run cmake again, and add the output to your question (i know, it's pretty long, but there will be something helpful buried in that) ?
I'm really sorry but I'm not sure how to edit the cmake output properly in opencv q&A
^^ don't worry ;)
looking at it, it seems, it did not build any module from opencv_contrib. (see: "To be build" section)
can you check again, if
~/opt/opencv_contrib/modules
is the correct path for yourOPENCV_EXTRA_MODULES
cmdline argument ?( the
~
in front of it looks pretty suspicious to me ;) )what did you do to format the output? Also as you can see from output, the extra modules from opencv_contrib are not being built but are also not unavailable? How is that possible even when my cmake path points to the opencv_contrib folder?
Yes, it is the correct path. Sometimes without the
~
, it goes to the other opt folder and not the one i made at home.mark all cmake output with mouse (not only 1st line), then press "10101" button
but again, my "current work hypothesis" is: cmake did not find the opencv_contrib modules (due to something wrong in
OPENCV_EXTRA_MODULES
try an absolute path, not a relative one
Could it be a problem with cmake then? Is there any other reason why it may be failing?
i don't think so.
Even with absolute path, the cmake output is the same.
Hey berak, I tried following this cmake command from this website
It seems to include the Opencv_contrib module but I'm facing this failure of download of boostdesc_bgm_bi.i file. I tried finding this file online but to no avail and this stackoverflow question faces the same problem but it hasn't been answered since Novemeber 19th?
This is the cmake error output- CMake Error at /home/kevmepls/opt/opencv/cmake/OpenCVUtils.cmake:1025 (message): Failed to download boostdesc_bgm_bi.i. Status=1;"Unsupported protocol" Call Stack (most recent call first):
Hey berak, I tried following this cmake command from this website
It seems to include the Opencv_contrib module but I'm facing this failure of download of boostdesc_bgm_bi.i file. I tried finding this file online but to no avail and this stackoverflow question faces the same problem but it hasn't been answered since Novemeber 19th.
This is the cmake error output-
Failed to download boostdesc_bgm_bi.i. Status=1;"Unsupported protocol"
shame, that you have such a hard time here ;(
http://answers.opencv.org/question/11...
Hey berak I'm having such an awesome time here with users like you who help :) . Thanks for the links berak, you might want to edit the second and third links as it is leading to resource not found. For second link in url path, the file name should be boostdesc_bgm_bi.i instead of boostdesc_bgm.bi.i . For third link in url path, the file name should be boostdesc_bgm_hd.i instead of boostdesc_bgm.hd.i .
Now I'm facing this Cmake error sadly :(
Do you know how to resolve this? I need libprotobuf to read caffe files.