Ask Your Question

Revision history [back]

Cannot Figure Out How To Run OpenCV

Hi there, I'm somewhat new to programming and have just been introduced to OpenCV. I'm trying to use opencv_traincascade for a project to detect whether someone is sleeping while driving. After reading the tutorial:

https://docs.opencv.org/master/dc/d88/tutorial_traincascade.html

I understand what I have to do in terms of the overall process. What I can't seem to do is get any of the opencv apps to work in terminal (I'm a MacOS user). Every time this is what happens:

fatal error: 'opencv2/core.hpp' file not found

when I type the command:

g++ -o traincascade traincascade.cpp

I downloaded OpenCV and tested it to make sure it worked in VSC with this tutorial:

https://thecodinginterface.com/blog/opencv-cpp-vscode/

And everything seemed to work fine. I know this is probably a dumb question but I cannot figure it out for the life of me. Any help is appreciated.