Hello everyone
I am new to using OpenCV on Linux and I have run into the following problem: I am trying to write some first C++ applications using OpenCV. I downloaded the source code (v.3.4.5) for OpenCV from their webpage. Then I compiled the source code using CMAKE, make and make install. So far everything went okay and I can compile and run the first example:
https://docs.opencv.org/3.2.0/db/df5...gcc_cmake.html
The problem is that when I try to compile the application in Debug mode using QtCreator, the same code as in the example won't work. Now I assume that is because I need to link the debug libraries for OpenCV when debugging, however, I'm not sure how I can get the debug libraries from the source code. So far I basically tried the following commands in the source-code
Code:
cmake -D WITH_QT=ON -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=/usr/local ..
make
sudo make install
As far as I know, the debug libraries should have the same name as the release libraries but with a "d" at the end, so for example "libopencv_core.so" should be called "libopencv_cored.so". I tried searching for "libopencv_cored.so" using:
Code:
sudo find / -name libopencv_cored.so
but such a file doesn't exist anywhere on the system so I guess my compilation does not create the required debug libraries? So my question is basically how I can compile the debug libraries from the source code?
The CMAKE code for my project currently looks like this:
Code:
cmake_minimum_required(VERSION 2.8)
project(opencv_0)
find_package(OpenCV REQUIRED)
INCLUDE_DIRECTORIES(${OpenCV_INCLUDE_DIRS})
add_executable(${PROJECT_NAME} "main.cpp")
target_link_libraries(opencv_0 debug ${OpenCV_LIBS})
And the C++ code looks like this:
Code:
#include <stdio.h>
#include <opencv2/opencv.hpp>
using namespace cv;
int main(int argc,char** argv)
{
Mat image;
image=imread("lenna.jpg",1);
if(!image.data){
printf("Could not read picture!\n");
return 1;
}
namedWindow("Display Image",WINDOW_AUTOSIZE);
imshow("Display Image",image);
waitKey(0);
return 0;
}