Running Tests
OpenCV contains a test suite for most functions in the tests/ subdirectory. One can run the tests (on linux at least) by running
make check
This calls two programs: tests/cv/src/cvtest and tests/cxcore/src/cxcoretest. To list the possible tests, run each with the -l argument. Currently cvtest contains some older tests that ignore this flag, and will run those after listing the available (newer style) tests.
If you'd like to test a particular function -- you'll have to create a configurations file that looks like
%YAML:1.0 filter_mode: (tests | functions) tests: <test_pattern1> <test_pattern2> functions: <function_pattern1> <function_pattern2>
For instance, to test all the color functions:
%YAML:1.0 filter_mode: tests tests: color-*
To test the cvSobel function:
%YAML:1.0 filter_mode: functions functions: cvSobel
Save this file with a .yml extension and run ./cvtest <foo.yml>
The specified test(s) will run and no others (except for old-style).
In addition to the information reported on stdout -- a number of log files will be written: foo.log foo.sum and foo.csv -- these all seem to contain more or less equivalent information, though foo.log is the most thorough, and will list which particular cases failed.
Writing Tests
TODO
