unable to build application in linux based on opencv::dnn module
hey everyone. i have written an application for implementing YOLO in c++ using opencv::dnn module. it works fine in windows but in linux i am unable to compile and build this application. actually i am unable to include dnn module in build process. can anyone guide me in this regard.
Error i get: "dnn" is not a namespace. (In) using namespace cv::dnn. Where ever i have used dnn it has given error there.
i am using opencv 4.1.0 ubuntu 16.04 and cmake build process
to show exactly what i am doing: i install opencv4.1.0 following this tutorial. https://www.youtube.com/watch?v=2Pboq... also i have "sdk" for cross compiling that also has opencv 4.1.0. when i do pkg-config --cflags opencv it gives path /usr/include/opencv and when i look for librares(pkg-config --libs opencv) it gives path for libs in "sdk".
now i take my code(that is working in windows) in ubuntu envrionment and try to build it with cmake. cmake script is below :
CMake script: cmake_minimum_required(VERSION 3.5)
project(OD_display)
add_compile_options(-std=c++11)
find_package(OpenCV)
include_directories(
include
${OpenCV_INCLUDE_DIRS}
)
message(STATUS "OpenCV library status:")
message(STATUS " config: ${OpenCV_DIR}")
message(STATUS " version: ${OpenCV_VERSION}")
message(STATUS " libraries: ${OpenCV_LIBS}")
message(STATUS " include path: ${OpenCV_INCLUDE_DIRS}")
add_executable(${PROJECT_NAME} src/source.cpp)
target_link_libraries(${PROJECT_NAME}
${OpenCV_LIBRARIES}
)
and message status comes out to be:
OpenCV library status:
-- config: /usr/share/OpenCV
-- version: 2.4.9.1
-- libraries: opencv_videostab;opencv_video;opencv_ts;opencv_superres;opencv_stitching;opencv_photo;opencv_ocl;opencv_objdetect;opencv_ml;opencv_legacy;opencv_imgproc;opencv_highgui;opencv_gpu;opencv_flann;opencv_features2d;opencv_core;opencv_contrib;opencv_calib3d
-- include path: /usr/include/opencv;/usr/include
-- Configuring done
-- Generating done
Make file gives multiple errors like this
/home/rizwan/Desktop/OD_ubuntu/include/Object_Detection.h:10:21: error: ‘dnn’ is not a namespace-name
using namespace cv::dnn;
^
/home/rizwan/Desktop/OD_ubuntu/include/Object_Detection.h:10:24: error: expected namespace-name before ‘;’ token
using namespace cv::dnn;
^
/home/rizwan/Desktop/OD_ubuntu/include/Object_Detection.h:26:37: error: ‘dnn’ in namespace ‘cv’ does not name a type
vector<String> getOutput(const cv::dnn::Net& net);
please add error messages
you probably need to show us, what you include, where and how ...
my bad, i add more details
@barek thankyou for editing the post. it looks more understandable now