Page 28 -
P. 28

2     Chapter 1 ■ Practical Aspects of a Vision System


                           new versions will require little or no modification to the vision programs that
                           depend on it. Such an API is the OpenCV system.


                           1.1    OpenCV


                           OpenCV was originally developed by Intel. At the time of this writing,
                           version 2.0 is current and can be downloaded from http://sourceforge
                           .net/projects/opencvlibrary/.
                             However, Version 2.0 is relatively new, yet it does not install and compile
                           with all of the major systems and compilers. All the examples in this book use
                           Version 1.1 from http://sourceforge.net/projects/opencvlibrary/files
                           /opencv-win/1.1pre1/OpenCV_1.1pre1a.exe/download,and compile with the
                           Microsoft Visual C++ 2008 Express Edition, which can be downloaded from
                           www.microsoft.com/express/Downloads/#2008-Visual-CPP.
                             The Algorithms for Image Processing and Computer Vision website
                           (www.wiley.com/go/jrparker) will maintain current links to new versions of
                           these tools. The website shows how to install both the compiler and OpenCV.
                           The advantage of using this combination of tools is that they are still pretty
                           current, they work, and they are free.



                           1.2    The Basic OpenCV Code

                           OpenCV is a library of C functions that implement both infrastructure oper-
                           ations and image-processing and vision functions. Developers can, of course,
                           add their own functions into the mix. Thus, any of the code described here
                           can be invoked from a program that uses the OpenCV paradigm, meaning
                           that the methods of this book are available in addition to those of OpenCV.
                           One simply needs to know how to call the library, and what the basic data
                           structures of open CV are.
                             OpenCV is a large and complex library. To assist everyone in starting to use
                           it, the following is a basic program that can be modified to do almost anything
                           that anyone would want:

                             // basic.c : A `wrapper´ for basic vision programs.
                             #include  ˝ stdafx.h˝
                             #include  ˝ cv.h˝
                             #include  ˝ highgui.h˝
                             int main (int argc, char* argv[])
                             {
                                 IplImage *image = 0;
   23   24   25   26   27   28   29   30   31   32   33