Skip to content

Commit 31d5af7

Browse files
committed
finished adding headers and output to the program examples in ch2
1 parent a533357 commit 31d5af7

6 files changed

+73
-2
lines changed

example_02-07.cpp

+16
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,23 @@
22
// 2
33
#include <opencv2/opencv.hpp>
44

5+
void help(char** argv ) {
6+
std::cout << "\n"
7+
<< "\nExample 2-7. The Canny edge detector writes its output to a single-channel (grayscale) image"
8+
<< "\nCall:\n"
9+
<< argv[0] <<" <path/image>\n"
10+
<< "For example:\n"
11+
<< argv[0] << " ../fruits.jpg\n"
12+
<< std::endl;
13+
}
14+
15+
516
int main( int argc, char** argv ) {
17+
18+
if (argc != 2) {
19+
help(argv);
20+
return 0;
21+
}
622

723
cv::Mat img_rgb, img_gry, img_cny;
824

example_02-08.cpp

+19-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,26 @@
1-
// In Example 2-9, we show a simple way to read and write pixel values from Example 2-8.
1+
// Example 2-8. Combining the pyramid down operator (twice) and the Canny
2+
// subroutine in a simple image pipeline
23
//2
34
#include <opencv2/opencv.hpp>
45

6+
void help(char** argv ) {
7+
std::cout << "\n"
8+
<< "\nExample 2-8. Combining the pyramid down operator (twice) and the Canny"
9+
<< "\n subroutine in a simple image pipeline"
10+
<< "\nCall:\n"
11+
<< argv[0] <<" <path/image>\n"
12+
<< "For example:\n"
13+
<< argv[0] << " ../fruits.jpg\n"
14+
<< std::endl;
15+
}
16+
17+
518
int main( int argc, char** argv ) {
19+
20+
if (argc != 2) {
21+
help(argv);
22+
return 0;
23+
}
624

725
cv::Mat img_rgb, img_gry, img_cny, img_pyr, img_pyr2;
826

example_02-09.cpp

+19
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,25 @@
1+
// Example 2-9. Getting and setting pixels in Example 2-8
2+
13
#include <opencv2/opencv.hpp>
24

5+
void help(char** argv ) {
6+
std::cout << "\n"
7+
<< "\nExample 2-9. Getting and setting pixels in Example 2-8"
8+
<< "\nCall:\n"
9+
<< argv[0] <<" <path/image>\n"
10+
<< "For example:\n"
11+
<< argv[0] << " ../fruits.jpg\n"
12+
<< std::endl;
13+
}
14+
15+
316
int main( int argc, char** argv ) {
17+
18+
if (argc != 2) {
19+
help(argv);
20+
return 0;
21+
}
22+
423

524
cv::Mat img_rgb, img_gry, img_cny, img_pyr, img_pyr2;
625

example_02-10.cpp

+17
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,24 @@
33
#include <opencv2/opencv.hpp>
44
#include <iostream>
55

6+
void help(char** argv ) {
7+
std::cout << "\n"
8+
<< "\nxample 2-10. The same object can load videos from a camera or a file"
9+
<< "\nCall:\n"
10+
<< argv[0] <<" [path/image]\n"
11+
<< "\nor, read from camera:\n"
12+
<< argv[0]
13+
<< "\nFor example:\n"
14+
<< argv[0] << " ../tree.avi\n"
15+
<< std::endl;
16+
}
17+
18+
619
int main( int argc, char** argv ) {
20+
21+
help(argv);
22+
23+
724

825
cv::namedWindow( "Example 2-10", cv::WINDOW_AUTOSIZE );
926
cv::VideoCapture cap;

example_02-11.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ void help(char** argv ) {
1111
<< argv[0] <<" <path/video> <paht/video_output>\n"
1212
<< "For example:\n"
1313
<< argv[0] << " ../tree.avi ../vout.avi\n"
14+
<< "\nThen read it with:\n ./example_02-10 ../vout.avi\n"
1415
<< std::endl;
1516
}
1617

example_08-02.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ using namespace std;
99
int main(int argc, char** argv) {
1010

1111
cout << "\nExample 8-2. Using cv::FileStorage to create a .yml data file\n"
12-
<< argv[0] << endl
12+
<< argv[0] << endl;
1313

1414
cv::FileStorage fs("test.yml", cv::FileStorage::WRITE);
1515

0 commit comments

Comments
 (0)