Chapter 2. Introduction to OpenCV
Getting Started
After installing the OpenCV library, our first task is, naturally, to get started and make something interesting happen. In order to do this, we will need to set up the programming environment.
In Visual Studio, it is necessary to create a project and to configure the setup so that (a) the libraries highgui.lib, cxcore.lib, ml.lib, and cv.lib are linked[8] and (b) the preprocessor will search the OpenCV …/opencv/*/include directories for header files. These "include" directories will typically be named something like C:/program files/opencv/cv/include,[9] …/opencv/cxcore/include, …/opencv/ml/include, and …/opencv/otherlibs/highgui. Once you've done this, you can create a new C file and start your first program.
Tip
Certain key header files can make your life much easier. Many useful macros are in the header files …/opencv/cxcore/include/cxtypes.h and cxmisc.h. These can do things like initialize structures and arrays in one line, sort lists, and so on. The most important headers for compiling are …/cv/include/cv.h and …/cxcore/include/cxcore.h for computer vision, …/otherlibs/highgui/highgui.h for I/O, and …/ml/include/ml.h for machine learning.
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access