How to use OpenCV on CLion with CMAKE

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello and welcome I'm going to show you how to actually use c-line opencv and symmet list which will let us include the library opencv itself within our projects the first thing you can install opencv by building its uh building it yourself as like on their GitHub you can search their GitHub and install the source one as you can see here you can download the zip and actually rebuild it yourself with I don't know teammate GUI or or different ways there's different ways to do but for Simplicity today I'm going to show you how to install through a package installer which is kinda easy in this case and you won't have to build it yourself and anything related to that so in this case I'm using package installer to install shocko it's really easy like you have to run a command in your powershells like it's not that hard you just follow the documentation everything will be linked like under my comments or description so in my case you just have to Powershell run it as an administrator in case you know and if you want to search for the opencv library itself on choco you can go there and search opencv there you go and you can see the latest version it have and the easiest way it's like it's really easy to install the click show for install opencv there you go it's going to install it in your case if it's the first time you're doing that but in my case I already have it so I I have to force it to reinstall and this video will help to set up like environment variables for opencv a configure C make list on C line or anything related to that if you're using cmake list you can do it like on Microsoft Visual Studio code or or like different software you can use so in this case it's it's installed you can see the directory where it's installed we're going to see it if it installed actually the same director is showing as you can see here tools opencv build yes we have everything the package itself is here so as you can see it's like it's really easy so in this case before like starting with C line we'll have to set up the environment variables you just have to search for environment variable there you go uh after that you have to go into an environment variable here and in the first place we'll have to set up the path variable here not not temporary but here and like path you you double click it no problem there and after you will have to add a new one which is uh like I'm going to delete this uh delete this one and you'll have to include or like make a new one in your case and actually copy and paste the the directory to opencv uh the bin directory you know and if you actually can go there it's build a 64 vc15 bin and you include it like that okay there's no problem here so the next step is to set up the system variables and here it's it's a little bit uh harder and gonna lie you'll have to include opencv directory and how to link it to your directory if it's installed anywhere else you'll just have to change it to where it's installed for your case but like for example I will link everything you need I mean I already have a GitHub with like everything formatted if you want to have a easier reading like that you can like copy and paste them it's like a lot easier after setting up everything correctly if you have any questions or have any problem just let me know in the comments you'll have to click ok ok and restart your PC it's to actually let Windows uh to apply the changes you you made to the environment variable and after that when it's installed opencv you have it you can close Powershell and I mean you can keep this open so now the goal is to go into sea lion so uh let let me make a new one project test there you go uh YouTube uh YouTube example here you go and we created a new one in this case uh if you want to include any Library outside of like C line and things like that you will have to use cmake list as you can see a blank project nothing is linked to it neither opencv or any other library in the first place we'll have to change the compiler settings in this case you'll have to search for Tool chain and I don't know why but when I use Min GW if opencv it's not working so I recommend you to use visual studio and if you want to change the order you just have to click on the on the arrow and like actually put it in the first place you know and maybe it's changed architecture for your PC you know just see if it's working in your case so after that after setting up the the tool chain itself you will have to search for a plugin called C make list as you can see uh on like on Marketplace it's not showing for me because I already have it installed and uh sea lion c-test as you can see they're like I already installed it you have to install the cement the cmake plugin itself you know before starting and after installing it it and after installing it just restart sea lion and maybe create a new project to generate a cmake list.txt this is the place where we are going to link opencv with cmic and sea lion so here in this case as you can see that's a blank uh like blank example there's nothing in here nothing is linked they're just like the the simplest boss there's just the C plus plus standard and things like that never forget to actually change the project variable you'll have to change the variable in your case so let's say your project is named I don't know my personal project you'll have to change this in your case if you're copy and pasting my comments from here my lines from here you will have to change the variables never forget that so in the first place just uh be sure to have the correct order for this so in this case we'll have to set the opencv directory which in this case for me it's the tools opencv build and you'll have to conclude the module path itself and like to to configure where is like the cmake files are located in opencv it's not really interesting to explain every little detail about cmec list there's a good documentation if you want to read it so here you have to find the package which is like uh to link it and link it you know and you after that you include the directories there you go uh set opencv Libs which is going to use the uh the modules we need and after Target link the libraries here you go and you can enable auto reload and as you can see I forgot to change the project name variable let me rename it for example there you go and it's going to restart there we go no problem here so in this case to be sure that it's working we're going to use an example from my GitHub I'm going to link it like uh under the comments don't worry so here it's just like opening a named window it's loading in into matte a nail like an image it's not on desktop anymore you find one it's in Miss so let me just change that real quick um mask there you go so it's going to load the images I need and actually match the template itself so we can start it and verify if opencv is working as you can see it's working no problem there it's detecting what I really need so there's no problem here normally if you really need some help there's a good documentation about the cmake list and opencv how to link them just be sure to actually change the the variables if you're copy and pasting things from the comments or like for uh from examples just be sure about that I hope this helps you if you have any question or need someone just let me know in the comments I will try to respond to it and I wish good luck see you
Info
Channel: Ethernel Tech
Views: 7,285
Rating: undefined out of 5
Keywords: cmake, cmakelist, opencv, clion, c++, programming, 2022, windows, linux, windows 11, windows 10, windows 8, how, to, how to, tutorial, installation, intellij, how to use, how to install, how to configure, how to set up, programming c, programming c++, 2021, 2023, 2020, Intellij Clion, Visual studio code, Cmake list, CMake
Id: fjq8eTuHnMM
Channel Id: undefined
Length: 8min 32sec (512 seconds)
Published: Mon Nov 07 2022
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.