Exercises
Download and install OpenCV if you have not already done so. Systematically go through the directory structure. Note in particular the docs directory; there you can load index.htm, which further links to the main documentation of the library. Further explore the main areas of the library. Cxcore contains the basic data structures and algorithms, cv contains the image processing and vision algorithms, ml includes algorithms for machine learning and clustering, and otherlibs/highgui contains the I/O functions. Check out the _make directory (containing the OpenCV build files) and also the samples directory, where example code is stored.
Go to the …/opencv/_make directory. On Windows, open the solution file opencv.sln; on Linux, open the appropriate makefile. Build the library in both the debug and the release versions. This may take some time, but you will need the resulting library and dll files.
Go to the …/opencv/samples/c/ directory. Create a project or make file and then import and build lkdemo.c (this is an example motion tracking program). Attach a camera to your system and run the code. With the display window selected, type "r" to initialize tracking. You can add points by clicking on video positions with the mouse. You can also switch to watching only the points (and not the image) by typing "n". Typing "n" again will toggle between "night" and "day" views.
Use the capture and store code in Example 2-10, together with the
doPyrDown()code of Example 2-5 to create a ...
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