Skip to content

Commit

Permalink
finished adding headers and output to the program examples in ch2
Browse files Browse the repository at this point in the history
  • Loading branch information
garybradski committed Jul 1, 2017
1 parent a533357 commit 31d5af7
Show file tree
Hide file tree
Showing 6 changed files with 73 additions and 2 deletions.
16 changes: 16 additions & 0 deletions example_02-07.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,23 @@
// 2
#include <opencv2/opencv.hpp>

void help(char** argv ) {
std::cout << "\n"
<< "\nExample 2-7. The Canny edge detector writes its output to a single-channel (grayscale) image"
<< "\nCall:\n"
<< argv[0] <<" <path/image>\n"
<< "For example:\n"
<< argv[0] << " ../fruits.jpg\n"
<< std::endl;
}


int main( int argc, char** argv ) {

if (argc != 2) {
help(argv);
return 0;
}

cv::Mat img_rgb, img_gry, img_cny;

Expand Down
20 changes: 19 additions & 1 deletion example_02-08.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,26 @@
// In Example 2-9, we show a simple way to read and write pixel values from Example 2-8.
// Example 2-8. Combining the pyramid down operator (twice) and the Canny
// subroutine in a simple image pipeline
//2
#include <opencv2/opencv.hpp>

void help(char** argv ) {
std::cout << "\n"
<< "\nExample 2-8. Combining the pyramid down operator (twice) and the Canny"
<< "\n subroutine in a simple image pipeline"
<< "\nCall:\n"
<< argv[0] <<" <path/image>\n"
<< "For example:\n"
<< argv[0] << " ../fruits.jpg\n"
<< std::endl;
}


int main( int argc, char** argv ) {

if (argc != 2) {
help(argv);
return 0;
}

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

Expand Down
19 changes: 19 additions & 0 deletions example_02-09.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,25 @@
// Example 2-9. Getting and setting pixels in Example 2-8

#include <opencv2/opencv.hpp>

void help(char** argv ) {
std::cout << "\n"
<< "\nExample 2-9. Getting and setting pixels in Example 2-8"
<< "\nCall:\n"
<< argv[0] <<" <path/image>\n"
<< "For example:\n"
<< argv[0] << " ../fruits.jpg\n"
<< std::endl;
}


int main( int argc, char** argv ) {

if (argc != 2) {
help(argv);
return 0;
}


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

Expand Down
17 changes: 17 additions & 0 deletions example_02-10.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,24 @@
#include <opencv2/opencv.hpp>
#include <iostream>

void help(char** argv ) {
std::cout << "\n"
<< "\nxample 2-10. The same object can load videos from a camera or a file"
<< "\nCall:\n"
<< argv[0] <<" [path/image]\n"
<< "\nor, read from camera:\n"
<< argv[0]
<< "\nFor example:\n"
<< argv[0] << " ../tree.avi\n"
<< std::endl;
}


int main( int argc, char** argv ) {

help(argv);



cv::namedWindow( "Example 2-10", cv::WINDOW_AUTOSIZE );
cv::VideoCapture cap;
Expand Down
1 change: 1 addition & 0 deletions example_02-11.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ void help(char** argv ) {
<< argv[0] <<" <path/video> <paht/video_output>\n"
<< "For example:\n"
<< argv[0] << " ../tree.avi ../vout.avi\n"
<< "\nThen read it with:\n ./example_02-10 ../vout.avi\n"
<< std::endl;
}

Expand Down
2 changes: 1 addition & 1 deletion example_08-02.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ using namespace std;
int main(int argc, char** argv) {

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

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

Expand Down

0 comments on commit 31d5af7

Please sign in to comment.