Skip to content

Commit 9f744c5

Browse files
authored
Merge pull request #51 from oreillymedia/gary
fixed a bunch of printouts
2 parents a62d0d1 + 20025e3 commit 9f744c5

12 files changed

+36
-23
lines changed

CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ add_executable( example_09-03 example_09-03.cpp )
4646
if(OPENGL_FOUND)
4747
add_executable( example_09-04 example_09-04.cpp )
4848
endif()
49+
# Can only build if you have Qt installed add_executable( example_09-05 example_09-05.cpp )
4950
add_executable( example_10-01 example_10-01.cpp )
5051
add_executable( example_10-02 example_10-02.cpp )
5152
add_executable( example_10-03 example_10-03.cpp )
@@ -122,6 +123,7 @@ target_link_libraries( example_09-03 ${OpenCV_LIBS} )
122123
if(OPENGL_FOUND)
123124
target_link_libraries( example_09-04 ${OpenCV_LIBS} ${OPENGL_LIBRARIES} )
124125
endif()
126+
# Need Qt target_link_libraries( example_09-05 ${OpenCV_LIBS} )
125127
target_link_libraries( example_10-01 ${OpenCV_LIBS} )
126128
target_link_libraries( example_10-02 ${OpenCV_LIBS} )
127129
target_link_libraries( example_10-03 ${OpenCV_LIBS} )

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ This is the example code that accompanies Learning OpenCV 3 by Adrian Kaehler an
66
~~In progress May 24, 2017~~
77
~~In progress June 13, 2017~~
88
~~In progress June 20, 2017~~
9-
In progress June 22, 2017
9+
~~In progress June 22, 2017~~
10+
In progress June 30, 2017
1011

1112
**To do:**
1213
* ~~Chapter 15~~
@@ -19,7 +20,7 @@ In progress June 22, 2017
1920
* ~~Chapter 22~~
2021

2122
Checking Chapters
22-
~~2,~~ 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, ~~15 16 17 18 19 20 21 22 23~~
23+
~~2, 3, 4, 5, 6, 7, 8, 9, 10, 11,~~ 12, 13, 14, ~~15 16 17 18 19 20 21 22 23~~
2324

2425
* Submit associated errata for ~~15 16~~ 17 18 19 20 21 22
2526
* Throw in some bonus material

box.png

49.5 KB
Loading

box_in_scene.png

120 KB
Loading

example_08-02.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ 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]
13+
<< "\n\n output: test.yml\n\n" << endl;
1314

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

example_09-02.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,9 @@ void draw_box( cv::Mat& img, cv::Rect box ) {
2424
);
2525
}
2626
void help(char** argv) {
27-
std::cout << "Call: " << argv[0] <<
28-
" shows how to use a mouse to draw regions in an image. Esc to quit" << std::endl;
27+
std::cout << "Example 9-2. Toy program for using a mouse to draw boxes on the screen"
28+
<< "\nCall:\n" << argv[0] <<
29+
"\n\nshows how to use a mouse to draw regions in an image. Esc to quit\n" << std::endl;
2930
}
3031
int main( int argc, char** argv ) {
3132
help(argv);

example_09-03.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,10 @@ void switch_callback( int position, void* ) {
2525
}
2626

2727
void help(char ** argv) {
28-
cout << "Call: " << argv[0] << " <my.avi>" << endl;
29-
cout << "Shows putting a pause button in a video; Esc to quit" << endl;
28+
cout << "Example 9-3. Using a trackbar to create a “switch” that the user can turn on and off"
29+
<< "\n this program plays a video and uses the switch to create a pause functionality."
30+
<< "\n\nCall:\n" << argv[0] << " <path/video_file>"
31+
<< "\n\nShows putting a pause button in a video; Esc to quit\n" << endl;
3032
}
3133

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

example_09-04.cpp

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,15 @@ void on_trackbar( int, void* ) {
5858
}
5959

6060
void help(char ** argv) {
61-
cout << "Call: " << argv[0] << " <image>" << endl;
62-
cout << "Here OpenGL is used to render a cube on top of an image.\n"
63-
<< "User can rotate the cube with the sliders" <<endl;
61+
62+
cout << "\n//Example 9-4. Slightly modified code from the OpenCV documentation that draws a"
63+
<< "\n//cube every frame; this modified version uses the global variables rotx and roty that are"
64+
<< "\n//connected to the sliders in Figure 9-6"
65+
<< "\n// Note: This example needs OpenGL installed on your system. It doesn't build if"
66+
<< "\n// the OpenGL libraries cannot be found.\n\/"
67+
<< "\nCall: " << argv[0] << " <image>\n\n"
68+
<< "\nHere OpenGL is used to render a cube on top of an image.\n"
69+
<< "\nUser can rotate the cube with the sliders\n" <<endl;
6470
}
6571

6672
int main(int argc, char* argv[])

example_09-05.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
using namespace std;
1111

1212
int main( int argc, char* argv[] ) {
13-
cout << "\nExample 9-5. An example program ch4_qt.cpp, which takes a single argument"
13+
cout << "\n\nExample 9-5. An example program ch4_qt.cpp, which takes a single argument"
1414
<< "\nindicating a video file; that video file will be replayed inside of a Qt object"
1515
<< "\nthat we will define, called QMoviePlayer"
1616
<< "\nCall:\n" << argv[0] << " <path/movie>"

example_10-01.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,14 @@ void sum_rgb( const cv::Mat& src, cv::Mat& dst ) {
2323
cv::threshold( s, dst, 100, 100, cv::THRESH_TRUNC );
2424
}
2525

26-
void help() {
27-
cout << "Call: ./example_10-03 ../faces.jpg" << endl;
28-
cout << "Shows use of alpha blending (addWeighted) and threshold" << endl;
26+
void help(char ** argv) {
27+
cout << "\nExample 10-1. Using cv::threshold() to sum three channels of an image\n" << endl;
28+
cout << "Call:\n" << argv[0] << " ../faces.jpg" << endl;
2929
}
3030

3131
int main(int argc, char** argv) {
32-
help();
33-
if(argc < 2) { cout << "specify input image" << endl; return -1; }
32+
help(argv);
33+
if(argc < 2) { cout << "\nSpecify input image" << endl; return -1; }
3434

3535
// Load the image from the given file name.
3636
//

example_10-02.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,13 @@ void sum_rgb( const cv::Mat& src, cv::Mat& dst ) {
2626
s.convertTo(dst, b.type());
2727
}
2828

29-
void help() {
30-
cout << "Call: ./example_10-02 ../faces.jpg" << endl;
31-
cout << "Shows an alternative use of alpha blending and threshold" << endl;
29+
void help(char **argv) {
30+
cout << "\nExample 10-2. Alternative method to combine and threshold image planes\n" << endl;
31+
cout << "\nCall:\n" << argv[0] << " ../faces.jpg\n" << endl;
3232
}
3333

3434
int main(int argc, char** argv) {
35-
help();
35+
help(argv);
3636
if(argc < 2) { cout << "specify input image" << endl; return -1; }
3737

3838
// Load the image from the given file name.

example_10-03.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ using namespace std;
77

88
int main( int argc, char** argv )
99
{
10-
if(argc != 7) { cout <<
11-
"Usage: " <<argv[0] <<" fixed_threshold invert(0=off|1=on) "
10+
if(argc != 7) { cout << "\nExample 10-3. Threshold versus adaptive threshold\n"
11+
"Usage:\n" <<argv[0] <<" fixed_threshold invert(0=off|1=on) "
1212
"adaptive_type(0=mean|1=gaussian) block_size offset image\n"
13-
"Example: " <<argv[0] <<" 100 1 0 15 10 ../faces.png\n"; return -1; }
13+
"Example:\n" <<argv[0] <<" 100 1 0 15 10 ../faces.png\n"; return -1; }
1414

1515
// Process command line arguments
1616
//

0 commit comments

Comments
 (0)