update cpp samples and tutorials

This commit is contained in:
Suleyman TURKMEN
2016-02-15 15:37:29 +02:00
parent 1aeff45631
commit 11ca1c95f8
110 changed files with 394 additions and 423 deletions

View File

@@ -1,7 +1,7 @@
#include "opencv2/core/core.hpp"
#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/core.hpp"
#include "opencv2/imgproc.hpp"
#include "opencv2/imgcodecs.hpp"
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/highgui.hpp"
#include <iostream>

View File

@@ -1,4 +1,4 @@
#include <opencv2/core/core.hpp>
#include <opencv2/core.hpp>
#include <iostream>
#include <string>

View File

@@ -16,7 +16,7 @@ static void help()
<< " we take an input image and divide the native color palette (255) with the " << endl
<< "input. Shows C operator[] method, iterators and at function for on-the-fly item address calculation."<< endl
<< "Usage:" << endl
<< "./howToScanImages imageNameToUse divideWith [G]" << endl
<< "./how_to_scan_images <imageNameToUse> <divideWith> [G]" << endl
<< "if you add a G parameter the image is processed in gray scale" << endl
<< "--------------------------------------------------------------------------" << endl
<< endl;

View File

@@ -1,12 +1,9 @@
//! [head]
#include <stdio.h>
#include <iostream>
#include <opencv2/core/core.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/imgproc.hpp>
#include "opencv2/imgcodecs.hpp"
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/core/utility.hpp>
#include <opencv2/highgui.hpp>
using namespace cv; // The new C++ interface API is inside this namespace. Import it.
using namespace std;

View File

@@ -1,5 +1,3 @@
#include <opencv2/core.hpp>
#include <opencv2/core/utility.hpp>
#include <opencv2/imgcodecs.hpp>
#include <opencv2/highgui.hpp>
#include <opencv2/imgproc.hpp>
@@ -25,38 +23,44 @@ int main( int argc, char* argv[])
help(argv[0]);
const char* filename = argc >=2 ? argv[1] : "../data/lena.jpg";
Mat I, J, K;
Mat src, dst0, dst1;
if (argc >= 3 && !strcmp("G", argv[2]))
I = imread( filename, IMREAD_GRAYSCALE);
src = imread( filename, IMREAD_GRAYSCALE);
else
I = imread( filename, IMREAD_COLOR);
src = imread( filename, IMREAD_COLOR);
if (src.empty())
{
cerr << "Can't open image [" << filename << "]" << endl;
return -1;
}
namedWindow("Input", WINDOW_AUTOSIZE);
namedWindow("Output", WINDOW_AUTOSIZE);
imshow("Input", I);
imshow( "Input", src );
double t = (double)getTickCount();
Sharpen(I, J);
Sharpen( src, dst0 );
t = ((double)getTickCount() - t)/getTickFrequency();
cout << "Hand written function times passed in seconds: " << t << endl;
imshow("Output", J);
waitKey(0);
imshow( "Output", dst0 );
waitKey();
Mat kern = (Mat_<char>(3,3) << 0, -1, 0,
Mat kernel = (Mat_<char>(3,3) << 0, -1, 0,
-1, 5, -1,
0, -1, 0);
t = (double)getTickCount();
filter2D(I, K, I.depth(), kern );
filter2D( src, dst1, src.depth(), kernel );
t = ((double)getTickCount() - t)/getTickFrequency();
cout << "Built-in filter2D time passed in seconds: " << t << endl;
imshow("Output", K);
imshow( "Output", dst1 );
waitKey(0);
waitKey();
return 0;
}
void Sharpen(const Mat& myImage,Mat& Result)

View File

@@ -1,6 +1,6 @@
/* For description look into the help() function. */
#include "opencv2/core/core.hpp"
#include "opencv2/core.hpp"
#include <iostream>
using namespace std;
@@ -15,7 +15,7 @@ static void help()
<< "That is, cv::Mat M(...); M.create and cout << M. " << endl
<< "Shows how output can be formated to OpenCV, python, numpy, csv and C styles." << endl
<< "Usage:" << endl
<< "./cvout_sample" << endl
<< "./mat_the_basic_image_container" << endl
<< "--------------------------------------------------------------------------" << endl
<< endl;
}