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

@@ -5,10 +5,9 @@
*/
#include "opencv2/imgcodecs.hpp"
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/highgui.hpp"
#include "opencv2/imgproc.hpp"
#include <iostream>
#include <stdio.h>
using namespace cv;
using namespace std;
@@ -24,10 +23,10 @@ int main( int, char** argv )
const char* equalized_window = "Equalized Image";
/// Load image
src = imread( argv[1], 1 );
src = imread( argv[1], IMREAD_COLOR );
if( src.empty() )
{ cout<<"Usage: ./Histogram_Demo <path_to_image>"<<endl;
{ cout<<"Usage: ./EqualizeHist_Demo <path_to_image>"<<endl;
return -1;
}

View File

@@ -5,10 +5,9 @@
*/
#include "opencv2/imgcodecs.hpp"
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/highgui.hpp"
#include "opencv2/imgproc.hpp"
#include <iostream>
#include <stdio.h>
using namespace std;
using namespace cv;
@@ -27,11 +26,24 @@ void MatchingMethod( int, void* );
/**
* @function main
*/
int main( int, char** argv )
int main( int argc, char** argv )
{
if (argc < 3)
{
cout << "Not enough parameters" << endl;
cout << "Usage:\n./MatchTemplate_Demo <image_name> <template_name>" << endl;
return -1;
}
/// Load image and template
img = imread( argv[1], 1 );
templ = imread( argv[2], 1 );
img = imread( argv[1], IMREAD_COLOR );
templ = imread( argv[2], IMREAD_COLOR );
if(img.empty() || templ.empty())
{
cout << "Can't read one of the images" << endl;
return -1;
}
/// Create windows
namedWindow( image_window, WINDOW_AUTOSIZE );

View File

@@ -4,9 +4,9 @@
* @author OpenCV team
*/
#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/imgproc.hpp"
#include "opencv2/imgcodecs.hpp"
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/highgui.hpp"
#include <iostream>
@@ -27,7 +27,13 @@ void Hist_and_Backproj(int, void* );
int main( int, char** argv )
{
/// Read the image
src = imread( argv[1], 1 );
src = imread( argv[1], IMREAD_COLOR );
if( src.empty() )
{ cout<<"Usage: ./calcBackProject_Demo1 <path_to_image>"<<endl;
return -1;
}
/// Transform it to HSV
cvtColor( src, hsv, COLOR_BGR2HSV );

View File

@@ -4,9 +4,9 @@
* @author OpenCV team
*/
#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/imgproc.hpp"
#include "opencv2/imgcodecs.hpp"
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/highgui.hpp"
#include <iostream>
@@ -30,7 +30,7 @@ void pickPoint (int event, int x, int y, int, void* );
int main( int, char** argv )
{
/// Read the image
src = imread( argv[1], 1 );
src = imread( argv[1], IMREAD_COLOR );
/// Transform it to HSV
cvtColor( src, hsv, COLOR_BGR2HSV );

View File

@@ -4,11 +4,10 @@
* @author
*/
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/highgui.hpp"
#include "opencv2/imgcodecs.hpp"
#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/imgproc.hpp"
#include <iostream>
#include <stdio.h>
using namespace std;
using namespace cv;
@@ -16,12 +15,19 @@ using namespace cv;
/**
* @function main
*/
int main( int, char** argv )
int main(int argc, char** argv)
{
Mat src, dst;
/// Load image
src = imread( argv[1], 1 );
String imageName( "../data/lena.jpg" ); // by default
if (argc > 1)
{
imageName = argv[1];
}
src = imread( imageName, IMREAD_COLOR );
if( src.empty() )
{ return -1; }

View File

@@ -5,10 +5,9 @@
*/
#include "opencv2/imgcodecs.hpp"
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/highgui.hpp"
#include "opencv2/imgproc.hpp"
#include <iostream>
#include <stdio.h>
using namespace std;
using namespace cv;
@@ -26,13 +25,19 @@ int main( int argc, char** argv )
/// Load three images with different environment settings
if( argc < 4 )
{
printf("** Error. Usage: ./compareHist_Demo <image_settings0> <image_setting1> <image_settings2>\n");
printf("** Error. Usage: ./compareHist_Demo <image_settings0> <image_settings1> <image_settings2>\n");
return -1;
}
src_base = imread( argv[1], 1 );
src_test1 = imread( argv[2], 1 );
src_test2 = imread( argv[3], 1 );
src_base = imread( argv[1], IMREAD_COLOR );
src_test1 = imread( argv[2], IMREAD_COLOR );
src_test2 = imread( argv[3], IMREAD_COLOR );
if(src_base.empty() || src_test1.empty() || src_test2.empty())
{
cout << "Can't read one of the images" << endl;
return -1;
}
/// Convert to HSV
cvtColor( src_base, hsv_base, COLOR_BGR2HSV );