C++版本的好处:
1、在于可以尽量避免使用指针这种危险的东西;
2、不用费心去release资源了,因为在其destructor里面,系统会自动帮你搞定。
3、在某些情况下会比C版本运行速度快。
在文件中包含 using namespace cv;
1. imread(cvLoadImage):loads an image from a file;
2. imshow(cvShowImage):displays an image in the specifiedwidow;
3. waitKey(cvWaitKey):waits for a pressed key;
4. cvtColor(cvCvtColor):converts an image from one colorspace to another;
5. reduce(cvReduce):reduces a matrix to a vector;
6. minMaxLoc(cvMinMaxLoc):finds the global minimum andmaximum in a whole array or sub-array;
7. namedWindow(cvNamedWindow):creates a window;
8. destroyWindow(cvDestroyWindow):destroys a window;
9. destroyAllWindows(cvDestroyAllWindows):destroys all of the HighGUIwindows;
10. imwrite(cvSaveImage):saves an image to a specified file;
11. resize(cvResize):resizes an image;
12. pyrDown(cvPyrDown):blurs an image and downsamples it;
13. pyrUp(cvPyrUp):upsamples an image and then blursit;
14. threshold(cvThreshold):applies a fixed-level threshold toeach array element;
15. adaptiveThreshold(cvAdaptiveThreshold):applies an adaptive threshold toan array;
16. VideoCapthure::open(cvCaptureFromFile):open video file or a capturingdevice for video capturing;
17. VideoCapture::isOpened:returns true if video capturinghas been initialized already;
18. VideoCapture::release(cvReleaseCapture):closes video file or capturingdevice;
19. VideoCapture::grab(cvGrabFrame):grabs the next frame from videofile or capturing device;
20. VideoCaputre::retrieve(cvRetrieveFrame):decodes and returns the grabbedvideo frame;
21. VideoCapture::read(cvQueryFrame):grabs,decodes and returns the nextvideo frame;
22. VideoCapture::get(cvGetCaptureProperty):returns the specified VideoCaptureproperty;
23. VideoCapture::set(cvSetCaptureProperty):sets a property in theVideoCapture;
24. VideoWriter::open:initializes or reinitializes videowriter;
25. VideoWriter::isOpened:returns true if video writer hasbeen successfully initialized;
26. VideoWriter::write:writes the next video frame;
27. Mat::row:creates a matrix header for thespecified matrix row;
28. Mat::col:creates a matrix header for thespecified matrix column;
29. Mat::rowRange:creates a matrix header for thespecified row span;
30. Mat::colRange:creates a matrix header for thespecified col span;
31. Mat::diag:extracts a diagonal from a matrix,or creates a diagonal matrix;
32. Mat::clone:creates a full copy of the arrayand the underlying data;
33. Mat::copyTo(cvCopy):copies the matrix to another one;
34. Mat::convertTo(cvConvertScale):converts an array to anotherdatatype with optional scaling;
35. Mat::assignTo:provides a functional form ofconvertTo;
36. Mat::setTo:sets all or some of the arrayelements to the specified value;
37. Mat::reshape:changes the shape and/or thenumber of channels of a 2D matrix without copying the data;
38. Mat::t:transposes a matrix;
39. Mat::inv:inverses a matrix;
40. Mat::mul:performs an element-wisemultiplication or division of the two matrices;
41. Mat::cross:computes a cross-product of two3-element vectors;
42. Mat::dot:computes a dot-product of twovectors;
43. Mat::zeros:returns a zero array of thespecified size and type;
44. Mat::ones:returns an array of all 1’s of thespecified size and type;
45. Mat::eye:returns an identity matrix of thespecified size and type;
46. Mat::create:allocates new array data if needed;
47. Mat::addref:increments the reference counter;
48. Mat::release:decrements the reference counterand deallocates the matrix if needed;
49. Mat::resize:changes the number of matrix rows;
50. Mat::reserve:reserves space for the certainnumber of rows;
51. Mat::push_back:adds elements to the bottom of thematrix;
52. Mat::pop_back:removes elements from the bottomof the matrix;
53. Mat::locateROI:locates the matrix header within aparent matrix;
54. Mat::adjustROI:adjusts a submatrix size andposition within the parent matrix;
55. M