Skip to content

Commit

Permalink
adding headers and output
Browse files Browse the repository at this point in the history
  • Loading branch information
garybradski committed Jun 30, 2017
1 parent 173bbe9 commit 1b37e8a
Show file tree
Hide file tree
Showing 5 changed files with 92 additions and 1 deletion.
18 changes: 18 additions & 0 deletions example_02-02.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,26 @@
// Example 2-2. Same as Example 2-1 but employing the “using namespace” directive

#include "opencv2/highgui/highgui.hpp"
#include <iostream>

using namespace cv;

void help(char** argv ) {
std::cout << "\n"
<< "2.2: Like 2.1, but 'using namespace cv: \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;
}

Mat img = imread( argv[1], -1 );

Expand Down
18 changes: 17 additions & 1 deletion example_02-03.cpp
Original file line number Diff line number Diff line change
@@ -1,10 +1,26 @@
// Example 2-3. A simple OpenCV program for playing a video file from disk

#include "opencv2/highgui/highgui.hpp"
#include "opencv2/imgproc/imgproc.hpp"
#include <iostream>

using namespace std;
void help(char** argv ) {
std::cout << "\n"
<< "2-03: play video from disk \n"
<< argv[0] <<" <path/video>\n"
<< "For example:\n"
<< argv[0] << " ../tree.avi\n"
<< std::endl;
}


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

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

cv::namedWindow( "Example 2-3", cv::WINDOW_AUTOSIZE );

Expand All @@ -30,7 +46,7 @@ int main( int argc, char** argv ) {
// cout <<((c&(0x1<<(31-i)))?1:0);
// }
// cout <<endl;
// cout <<"Breakey: '" <<(int)c <<"'"<<endl;
// cout <<"Break key: '" <<(int)c <<"'"<<endl;
// if( (signed char)c >= 0 ) {
// break;
// }
Expand Down
20 changes: 20 additions & 0 deletions example_02-04.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
//Example 2-4. Adding a trackbar slider to the basic viewer window for moving around
//within the video file

#include "opencv2/highgui/highgui.hpp"
#include "opencv2/imgproc/imgproc.hpp"
#include <iostream>
Expand All @@ -18,7 +21,24 @@ void onTrackbarSlide( int pos, void *) {
g_dontset = 0;

}


void help(char** argv ) {
std::cout << "\n"
<< "2-04: Addeing a trackbar to a basic viewer for moving w/in the video file \n"
<< argv[0] <<" <path/video>\n"
<< "For example:\n"
<< argv[0] << " ../tree.avi\n"
<< std::endl;
}


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

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

cv::namedWindow( "Example 2-4", cv::WINDOW_AUTOSIZE );

Expand Down
19 changes: 19 additions & 0 deletions example_02-05.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,25 @@
// Example 2-5. Loading and then smoothing an image before it is displayed on the screen

#include <opencv2/opencv.hpp>



void help(char** argv ) {
std::cout << "\n"
<< "2-05: load and smooth an image before displaying \n"
<< argv[0] <<" <path/video>\n"
<< "For example:\n"
<< argv[0] << " ../tree.avi\n"
<< std::endl;
}


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

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

// Load an image specified on the command line.
//
Expand Down
18 changes: 18 additions & 0 deletions example_02-06.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,24 @@
// Example 2-6. Using cv::pyrDown() to create a new image that is half the width and
// height of the input image
#include <opencv2/opencv.hpp>

void help(char** argv ) {
std::cout << "\n"
<< "2-06: AUsing cv::pyrDown() to create a new image that is half the width and"
<< " height of the input image\n"
<< argv[0] <<" <path/image>\n"
<< "For example:\n"
<< argv[0] << " ../faces.png\n"
<< std::endl;
}


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

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

cv::Mat img1,img2;

Expand Down

0 comments on commit 1b37e8a

Please sign in to comment.