Skip to content

Commit

Permalink
fixed a bunch of printouts
Browse files Browse the repository at this point in the history
  • Loading branch information
garybradski committed Jul 1, 2017
1 parent a62d0d1 commit 20025e3
Show file tree
Hide file tree
Showing 12 changed files with 36 additions and 23 deletions.
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ add_executable( example_09-03 example_09-03.cpp )
if(OPENGL_FOUND)
add_executable( example_09-04 example_09-04.cpp )
endif()
# Can only build if you have Qt installed add_executable( example_09-05 example_09-05.cpp )
add_executable( example_10-01 example_10-01.cpp )
add_executable( example_10-02 example_10-02.cpp )
add_executable( example_10-03 example_10-03.cpp )
Expand Down Expand Up @@ -122,6 +123,7 @@ target_link_libraries( example_09-03 ${OpenCV_LIBS} )
if(OPENGL_FOUND)
target_link_libraries( example_09-04 ${OpenCV_LIBS} ${OPENGL_LIBRARIES} )
endif()
# Need Qt target_link_libraries( example_09-05 ${OpenCV_LIBS} )
target_link_libraries( example_10-01 ${OpenCV_LIBS} )
target_link_libraries( example_10-02 ${OpenCV_LIBS} )
target_link_libraries( example_10-03 ${OpenCV_LIBS} )
Expand Down
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ This is the example code that accompanies Learning OpenCV 3 by Adrian Kaehler an
~~In progress May 24, 2017~~
~~In progress June 13, 2017~~
~~In progress June 20, 2017~~
In progress June 22, 2017
~~In progress June 22, 2017~~
In progress June 30, 2017

**To do:**
* ~~Chapter 15~~
Expand All @@ -19,7 +20,7 @@ In progress June 22, 2017
* ~~Chapter 22~~

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

* Submit associated errata for ~~15 16~~ 17 18 19 20 21 22
* Throw in some bonus material
Expand Down
Binary file added box.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added box_in_scene.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 2 additions & 1 deletion example_08-02.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ 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]
<< "\n\n output: test.yml\n\n" << endl;

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

Expand Down
5 changes: 3 additions & 2 deletions example_09-02.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,9 @@ void draw_box( cv::Mat& img, cv::Rect box ) {
);
}
void help(char** argv) {
std::cout << "Call: " << argv[0] <<
" shows how to use a mouse to draw regions in an image. Esc to quit" << std::endl;
std::cout << "Example 9-2. Toy program for using a mouse to draw boxes on the screen"
<< "\nCall:\n" << argv[0] <<
"\n\nshows how to use a mouse to draw regions in an image. Esc to quit\n" << std::endl;
}
int main( int argc, char** argv ) {
help(argv);
Expand Down
6 changes: 4 additions & 2 deletions example_09-03.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,10 @@ void switch_callback( int position, void* ) {
}

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

int main( int argc, char** argv ) {
Expand Down
12 changes: 9 additions & 3 deletions example_09-04.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,15 @@ void on_trackbar( int, void* ) {
}

void help(char ** argv) {
cout << "Call: " << argv[0] << " <image>" << endl;
cout << "Here OpenGL is used to render a cube on top of an image.\n"
<< "User can rotate the cube with the sliders" <<endl;

cout << "\n//Example 9-4. Slightly modified code from the OpenCV documentation that draws a"
<< "\n//cube every frame; this modified version uses the global variables rotx and roty that are"
<< "\n//connected to the sliders in Figure 9-6"
<< "\n// Note: This example needs OpenGL installed on your system. It doesn't build if"
<< "\n// the OpenGL libraries cannot be found.\n\/"
<< "\nCall: " << argv[0] << " <image>\n\n"
<< "\nHere OpenGL is used to render a cube on top of an image.\n"
<< "\nUser can rotate the cube with the sliders\n" <<endl;
}

int main(int argc, char* argv[])
Expand Down
2 changes: 1 addition & 1 deletion example_09-05.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
using namespace std;

int main( int argc, char* argv[] ) {
cout << "\nExample 9-5. An example program ch4_qt.cpp, which takes a single argument"
cout << "\n\nExample 9-5. An example program ch4_qt.cpp, which takes a single argument"
<< "\nindicating a video file; that video file will be replayed inside of a Qt object"
<< "\nthat we will define, called QMoviePlayer"
<< "\nCall:\n" << argv[0] << " <path/movie>"
Expand Down
10 changes: 5 additions & 5 deletions example_10-01.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@ void sum_rgb( const cv::Mat& src, cv::Mat& dst ) {
cv::threshold( s, dst, 100, 100, cv::THRESH_TRUNC );
}

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

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

// Load the image from the given file name.
//
Expand Down
8 changes: 4 additions & 4 deletions example_10-02.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@ void sum_rgb( const cv::Mat& src, cv::Mat& dst ) {
s.convertTo(dst, b.type());
}

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

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

// Load the image from the given file name.
Expand Down
6 changes: 3 additions & 3 deletions example_10-03.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ using namespace std;

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

// Process command line arguments
//
Expand Down

0 comments on commit 20025e3

Please sign in to comment.