Update Samples

This commit is contained in:
Suleyman TURKMEN
2019-07-28 12:09:17 +03:00
committed by sturkmen72
parent 9ef5373776
commit f73395122c
72 changed files with 251 additions and 271 deletions
@@ -22,8 +22,8 @@ int main( int argc, char** argv )
{
/// Read image given by user
//! [basic-linear-transform-load]
CommandLineParser parser( argc, argv, "{@input | ../data/lena.jpg | input image}" );
Mat image = imread( parser.get<String>( "@input" ) );
CommandLineParser parser( argc, argv, "{@input | lena.jpg | input image}" );
Mat image = imread( samples::findFile( parser.get<String>( "@input" ) ) );
if( image.empty() )
{
cout << "Could not open or find the image!\n" << endl;
@@ -67,7 +67,7 @@ int main( int argc, char** argv )
imshow("Original Image", image);
imshow("New Image", new_image);
/// Wait until user press some key
/// Wait until the user press a key
waitKey();
//! [basic-linear-transform-display]
return 0;
@@ -31,8 +31,8 @@ void Dilation( int, void* );
int main( int argc, char** argv )
{
/// Load an image
CommandLineParser parser( argc, argv, "{@input | ../data/LinuxLogo.jpg | input image}" );
src = imread( parser.get<String>( "@input" ), IMREAD_COLOR );
CommandLineParser parser( argc, argv, "{@input | LinuxLogo.jpg | input image}" );
src = imread( samples::findFile( parser.get<String>( "@input" ) ), IMREAD_COLOR );
if( src.empty() )
{
cout << "Could not open or find the image!\n" << endl;
@@ -33,13 +33,13 @@ void Morphology_Operations( int, void* );
int main( int argc, char** argv )
{
//![load]
CommandLineParser parser( argc, argv, "{@input | ../data/baboon.jpg | input image}" );
src = imread( parser.get<String>( "@input" ), IMREAD_COLOR );
CommandLineParser parser( argc, argv, "{@input | baboon.jpg | input image}" );
src = imread( samples::findFile( parser.get<String>( "@input" ) ), IMREAD_COLOR );
if (src.empty())
{
std::cout << "Could not open or find the image!\n" << std::endl;
std::cout << "Usage: " << argv[0] << " <Input image>" << std::endl;
return -1;
return EXIT_FAILURE;
}
//![load]
@@ -27,16 +27,16 @@ int main( int argc, char** argv )
" * [ESC] -> Close program \n" << endl;
//![load]
const char* filename = argc >=2 ? argv[1] : "../data/chicky_512.png";
const char* filename = argc >=2 ? argv[1] : "chicky_512.png";
// Loads an image
Mat src = imread( filename );
Mat src = imread( samples::findFile( filename ) );
// Check if image is loaded fine
if(src.empty()){
printf(" Error opening image\n");
printf(" Program Arguments: [image_name -- default ../data/chicky_512.png] \n");
return -1;
printf(" Program Arguments: [image_name -- default chicky_512.png] \n");
return EXIT_FAILURE;
}
//![load]
@@ -65,5 +65,5 @@ int main( int argc, char** argv )
}
//![loop]
return 0;
return EXIT_SUCCESS;
}
@@ -33,14 +33,14 @@ int main( int argc, char ** argv )
namedWindow( window_name, WINDOW_AUTOSIZE );
/// Load the source image
const char* filename = argc >=2 ? argv[1] : "../data/lena.jpg";
const char* filename = argc >=2 ? argv[1] : "lena.jpg";
src = imread( filename, IMREAD_COLOR );
if(src.empty())
src = imread( samples::findFile( filename ), IMREAD_COLOR );
if (src.empty())
{
printf(" Error opening image\n");
printf(" Usage: ./Smoothing [image_name -- default ../data/lena.jpg] \n");
return -1;
printf(" Usage:\n %s [image_name-- default lena.jpg] \n", argv[0]);
return EXIT_FAILURE;
}
if( display_caption( "Original Image" ) != 0 )
@@ -49,16 +49,16 @@ static void Threshold_Demo( int, void* )
int main( int argc, char** argv )
{
//! [load]
String imageName("../data/stuff.jpg"); // by default
String imageName("stuff.jpg"); // by default
if (argc > 1)
{
imageName = argv[1];
}
src = imread( imageName, IMREAD_COLOR ); // Load an image
src = imread( samples::findFile( imageName ), IMREAD_COLOR ); // Load an image
if (src.empty())
{
cout << "Cannot read image: " << imageName << std::endl;
cout << "Cannot read the image: " << imageName << std::endl;
return -1;
}
@@ -72,16 +72,16 @@ int main( int argc, char** argv )
//! [trackbar]
createTrackbar( trackbar_type,
window_name, &threshold_type,
max_type, Threshold_Demo ); // Create Trackbar to choose type of Threshold
max_type, Threshold_Demo ); // Create a Trackbar to choose type of Threshold
createTrackbar( trackbar_value,
window_name, &threshold_value,
max_value, Threshold_Demo ); // Create Trackbar to choose Threshold value
max_value, Threshold_Demo ); // Create a Trackbar to choose Threshold value
//! [trackbar]
Threshold_Demo( 0, 0 ); // Call the function to initialize
/// Wait until user finishes program
/// Wait until the user finishes the program
waitKey();
return 0;
}
@@ -1,5 +1,6 @@
#include "opencv2/imgproc.hpp"
#include "opencv2/highgui.hpp"
#include "opencv2/videoio.hpp"
#include <iostream>
using namespace cv;
@@ -64,8 +64,8 @@ void on_gamma_correction_trackbar(int, void *)
int main( int argc, char** argv )
{
CommandLineParser parser( argc, argv, "{@input | ../data/lena.jpg | input image}" );
img_original = imread( parser.get<String>( "@input" ) );
CommandLineParser parser( argc, argv, "{@input | lena.jpg | input image}" );
img_original = imread( samples::findFile( parser.get<String>( "@input" ) ) );
if( img_original.empty() )
{
cout << "Could not open or find the image!\n" << endl;
@@ -17,8 +17,8 @@ using namespace cv;
int main(int argc, char** argv)
{
//! [load_image]
CommandLineParser parser(argc, argv, "{@input | ../data/notes.png | input image}");
Mat src = imread(parser.get<String>("@input"), IMREAD_COLOR);
CommandLineParser parser(argc, argv, "{@input | notes.png | input image}");
Mat src = imread( samples::findFile( parser.get<String>("@input") ), IMREAD_COLOR);
if (src.empty())
{
cout << "Could not open or find the image!\n" << endl;