diff --git a/CMakeLists.txt b/CMakeLists.txt index 7398808..5703f53 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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 ) @@ -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} ) diff --git a/README.md b/README.md index 31b6991..feb55fd 100644 --- a/README.md +++ b/README.md @@ -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~~ @@ -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 diff --git a/box.png b/box.png new file mode 100644 index 0000000..6f01082 Binary files /dev/null and b/box.png differ diff --git a/box_in_scene.png b/box_in_scene.png new file mode 100644 index 0000000..cff246a Binary files /dev/null and b/box_in_scene.png differ diff --git a/example_08-02.cpp b/example_08-02.cpp index b7ce3bc..eef486e 100644 --- a/example_08-02.cpp +++ b/example_08-02.cpp @@ -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); diff --git a/example_09-02.cpp b/example_09-02.cpp index 8d4c233..c8e371f 100644 --- a/example_09-02.cpp +++ b/example_09-02.cpp @@ -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); diff --git a/example_09-03.cpp b/example_09-03.cpp index 8a69c67..fc90015 100644 --- a/example_09-03.cpp +++ b/example_09-03.cpp @@ -25,8 +25,10 @@ void switch_callback( int position, void* ) { } void help(char ** argv) { - cout << "Call: " << argv[0] << " " << 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] << " " + << "\n\nShows putting a pause button in a video; Esc to quit\n" << endl; } int main( int argc, char** argv ) { diff --git a/example_09-04.cpp b/example_09-04.cpp index e9ce7fb..615b8e3 100644 --- a/example_09-04.cpp +++ b/example_09-04.cpp @@ -58,9 +58,15 @@ void on_trackbar( int, void* ) { } void help(char ** argv) { - cout << "Call: " << argv[0] << " " << endl; - cout << "Here OpenGL is used to render a cube on top of an image.\n" - << "User can rotate the cube with the sliders" <\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" <" diff --git a/example_10-01.cpp b/example_10-01.cpp index c9948b1..9f7ebce 100644 --- a/example_10-01.cpp +++ b/example_10-01.cpp @@ -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. // diff --git a/example_10-02.cpp b/example_10-02.cpp index 77352de..ed5bb54 100644 --- a/example_10-02.cpp +++ b/example_10-02.cpp @@ -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. diff --git a/example_10-03.cpp b/example_10-03.cpp index cb55090..6f4f82b 100644 --- a/example_10-03.cpp +++ b/example_10-03.cpp @@ -7,10 +7,10 @@ using namespace std; int main( int argc, char** argv ) { - if(argc != 7) { cout << - "Usage: " <