How to setup OpenCV and C++ on Windows for Vision Processing
This guide will navigate you through the process of setting up your windows PC and CLion IDE for OpenCV and C++ Development with.
OpenCV: The Open Source Computer Vision Library, or OpenCV, is your Swiss Army knife for image processing. It boasts a treasure trove of functions for tasks like image recognition, feature detection, object tracking, and much more.
CLion: This IDE from JetBrains, known for its C/C++ prowess, offers a robust and intuitive environment to code your image processing adventures. With code completion, debugging tools, and integration with OpenCV, CLion becomes your trusty companion on this vision quest.
Getting Started.
- OpenCV Download: Head to https://opencv.org/releases/ and grab the latest stable version of OpenCV for Windows.
- OpenCV Installation: Run the downloaded installer and follow the instructions. Remember to select the installation directory where you want OpenCV libraries to reside (e.g., C:\opencv).
- CLion Download: Download CLion from https://www.jetbrains.com/clion/download/. Choose the free or subscription version based on your needs.
- CLion Installation: Run the CLion installer and complete the setup. During the process, ensure C/C++ development tools are selected and choose the same installation directory for OpenCV libraries (e.g., C:\opencv\bin).
Completing the setup
Lets create an example project to test out our current OpenCV setup
Open CLion IDE and create a new project. Simpy tap “New Project”
Setup your project configuration and tap Create.
Once this step is complete a blank project should be initialized.
Open CMakeList.txt file and modify it as below
Run your project.
Please Note.
In the project above my CMakeList file has openCV directory set to C:/tools/opencv/build/x664/vc16/lib, modify that line to actually point to your openCV installation directory
With this your OpenCV setup should be complete and you can now start coding.
Happy Coding 😊😊😊