Opencv installation and productivity development tips for 2024

Here are my three Opencv installations by VCPKG (Cmake) and productivity tips for 2024. Opencv is a great library used in many machine learning projects nowadays for image and video processing. I hope you will find these three tips useful and save some time. Happy coding.

Content:

  • Using VCPKG, Additionally to existing texts, installation of dnn-cuda for Opencv
  • Cmake for every project used in 2024
  • ChatGPT generates common parts of the code

Opencv tips and tricks for 2024

Custom Opencv installation by VCPKG

I used to build OpenCV from the source. This contains downloading and installing dependencies and prerequisites then configuring the CMake project to compile OpenCV. It was time-consuming with lots of hours of problem resolution during compilation and linking. I started to use the VCPKG package manager this year and for small projects: I will never go back to my old approach. The integration for Visual Studio 2022 is awesome and saves you a lot of time. More about this in the following blog post on funvision, VCPKG Visual Studio integration
The DLLs are automatically copied next to your executable files, which saves you a lot of time during development. The program has all dependencies in the folder once needed to run. The VCPKG usually downloads all prerequisites, but some need to be installed manually. I need to rebuild Opencv by following the command that installs dnn-cuda ap to my usual configuration. As you can see, I need to install cudnn manually first. It is one of the dependencies which are not handled automatically. This situation is very rare. The following command runs without any issues after the resolution of the instruction given during of first attend. 
The copy of the correct DLLs next to the project executable is me huge benefit for my workflow. 

CMake Opencv projects

The integration of VCPKG and Visual Studio is great. Your include directories and library dependencies are prepared after the restart of Visual Studio. I want to sometimes use VS code instead of VS 2022. Compile the project from the command line. So, my project directory usually contains the source code, CmakeLists.txt, and the build folder. The commands under CmakeLists.txt can be used to configure and build your application. The build folder then contains the VS 2022 project which can be opened in parallel. The following is project CmakeLists.txt for Opencv and FFMPEG installed by VCPKG. The CMake integration with VCPKG is great as well. More details can be found in the tutorial here: CMake use of VCPKG.

ChatGPT for Opencv development

The ability to write code will be less and less important. At least the common code components that can be found on the internet. The innovation will still belong to humans for some time, but you can speed up your workflows by using LLM ChatGPT models for the comment part. My workflow currently looks like generating the common parts from some LLM assistant, then enhancing the code and bringing some new ideas to the table. The basic, common, and even advanced parts of code can be currently generated by LL models as in the example here: 
Using microsoft copilot
My personal experience is that ChatGPT is capable of many tasks if you can put into your prompt exact specifications. The usual workflow starts to generate some corpus of code to work with. The problem for most people will be the technical limitations to formulate correct questions and specifications. I mean the knowledge of the specific domain. The machine will not give you what you want if you do not know what you want. 

Conclusion for 2024 tips

All of my tips are related to saving your time. Using VCPKG will save you some time installing a variety of open-source libraries. Using Cmake for all your projects will save you some time as well. I recently started to combine lightweight VS code for Windows or remote Linux development together with VS 2022. I am using VS 2022 for the performance evaluation, measurement, and final tuning of the code. The cmake gave me a great project standard to work from both these environments at the same on multiple platforms. 
 ChatGPT will not solve all your problems. It can help you a lot with programming, but the main challenge is what to ask for. The need for a specific programming language will be less and less important, but the knowledge of architecture and engineering to build new concepts will be needed for a longer time than the ability to write code. 

Next Post Previous Post
1 Comments
  • milkialisa
    milkialisa April 22, 2024 at 5:05 AM

    Our Agency is a dynamic and innovative Digital Marketing Services firm dedicated to helping businesses thrive in the ever-evolving online landscape. With a focus on creativity, strategy, and results-driven solutions, we partner with clients to elevate their brand presence, engage their audience, and achieve measurable success in the digital realm.

Add Comment
comment url