Switch to C++
I've decided to switch to C++, primarily because I like to use default parameters. For example, in the OpenCV 0.9.6 Documentation the Canny edge detector is defined as:
That means that you can call cvCanny like this:
Or like this:
And either way will work in C++. C does not support this functionality. So, from now on, anything I post here probably won't compile like this:
But it will compile like this:
Even though the underlying program may be entirely C except for the OpenCV calls.
void cvCanny( const CvArr* image, CvArr* edges, double threshold1,
double threshold2, int aperture_size=3 );
That means that you can call cvCanny like this:
cvCanny(sourceimage, resultimage, low_threshold, high_threshold);
Or like this:
cvCanny(sourceimage, resultimage, low_threshold, high_threshold, aperature_size);
And either way will work in C++. C does not support this functionality. So, from now on, anything I post here probably won't compile like this:
gcc test.cpp -o test `pkg-config --libs opencv --cflags opencv`
But it will compile like this:
g++ test.cpp -o test `pkg-config --libs opencv --cflags opencv`
Even though the underlying program may be entirely C except for the OpenCV calls.