I am writing a code for object detection and coordination finding in OpenCV. In windows, everything is done and the program is working wit no problem, but I need to move it to Linux and run OpenCV in Raspberry pi 3 and Linux Debian platform. I have tried many ways to install the OpenCV on Raspberry Pi and after long hours spending, I was not successful in loading te #inlcude files of OpenCV to use and also I cannot even define a "Mat" for loading an image.

I appreciate any help or tip to solve this issue.




Have you installed the OpenCV development packages from the repository (usually suffixed with -dev )? Without knowing the specific components of OpenCV you are using, version or programming language, I am assuming you want to use the most common header files. You may need to include others depending on your requirements but the following is a basic guide.

From the terminal install the header files with:

$ sudo apt-get install libcv-dev libhighgui-dev

The current version in the repositories is 2.4. If using C++, the header files are included as an example:

#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>

In your code use the namespace using namespace cv; or prefix OpenCV objects with cv:: as in cv::Mat image; or cv::Point point;.

Again in C++ don't forget to add the following, usually at the end of your compile statement:

`pkg-config --cflags --libs opencv`

For example:

$ g++ test_opencv.cpp -o test_opencv `pkg-config --cflags --libs opencv`
  • How is your experience with the debian opencv package? I did build openCV 3.2 with cmake and neon optimization and believe this is the way to go, although it's some work to get all the prerequisites.
    – Philippos
    Apr 26 '17 at 6:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.