Build tutorial codes together with other samples

These codes should be included into regular builds.
This commit is contained in:
Andrey Kamaev
2012-11-07 18:21:20 +04:00
parent 6484732509
commit b131dfeecd
58 changed files with 420 additions and 354 deletions

View File

@@ -4,8 +4,7 @@
* @author OpenCV team
*/
#include <cv.h>
#include <highgui.h>
#include "opencv2/highgui/highgui.hpp"
#include <iostream>
using namespace cv;
@@ -14,7 +13,7 @@ using namespace cv;
* @function main
* @brief Main function
*/
int main( int argc, char** argv )
int main( void )
{
double alpha = 0.5; double beta; double input;
@@ -35,8 +34,8 @@ int main( int argc, char** argv )
src1 = imread("../images/LinuxLogo.jpg");
src2 = imread("../images/WindowsLogo.jpg");
if( !src1.data ) { printf("Error loading src1 \n"); return -1; }
if( !src2.data ) { printf("Error loading src2 \n"); return -1; }
if( !src1.data ) { std::cout<< "Error loading src1"<<std::endl; return -1; }
if( !src2.data ) { std::cout<< "Error loading src2"<<std::endl; return -1; }
/// Create Windows
namedWindow("Linear Blend", 1);

View File

@@ -4,8 +4,7 @@
* @author OpenCV team
*/
#include <cv.h>
#include <highgui.h>
#include "opencv2/highgui/highgui.hpp"
#include <iostream>
using namespace cv;
@@ -17,7 +16,7 @@ int beta; /**< Simple brightness control */
* @function main
* @brief Main function
*/
int main( int argc, char** argv )
int main( int, char** argv )
{
/// Read image given by user
Mat image = imread( argv[1] );

View File

@@ -6,7 +6,6 @@
#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/highgui/highgui.hpp"
#include "highgui.h"
#include <stdlib.h>
#include <stdio.h>
@@ -29,7 +28,7 @@ void Dilation( int, void* );
/**
* @function main
*/
int main( int argc, char** argv )
int main( int, char** argv )
{
/// Load an image
src = imread( argv[1] );
@@ -73,7 +72,7 @@ int main( int argc, char** argv )
*/
void Erosion( int, void* )
{
int erosion_type;
int erosion_type = 0;
if( erosion_elem == 0 ){ erosion_type = MORPH_RECT; }
else if( erosion_elem == 1 ){ erosion_type = MORPH_CROSS; }
else if( erosion_elem == 2) { erosion_type = MORPH_ELLIPSE; }
@@ -91,7 +90,7 @@ void Erosion( int, void* )
*/
void Dilation( int, void* )
{
int dilation_type;
int dilation_type = 0;
if( dilation_elem == 0 ){ dilation_type = MORPH_RECT; }
else if( dilation_elem == 1 ){ dilation_type = MORPH_CROSS; }
else if( dilation_elem == 2) { dilation_type = MORPH_ELLIPSE; }

View File

@@ -21,7 +21,7 @@ int const max_operator = 4;
int const max_elem = 2;
int const max_kernel_size = 21;
char* window_name = "Morphology Transformations Demo";
const char* window_name = "Morphology Transformations Demo";
/** Function Headers */
@@ -30,7 +30,7 @@ void Morphology_Operations( int, void* );
/**
* @function main
*/
int main( int argc, char** argv )
int main( int, char** argv )
{
/// Load an image
src = imread( argv[1] );

View File

@@ -15,13 +15,13 @@ using namespace cv;
/// Global variables
Mat src, dst, tmp;
char* window_name = "Pyramids Demo";
const char* window_name = "Pyramids Demo";
/**
* @function main
*/
int main( int argc, char** argv )
int main( void )
{
/// General instructions
printf( "\n Zoom In-Out demo \n " );
@@ -44,7 +44,7 @@ int main( int argc, char** argv )
imshow( window_name, dst );
/// Loop
while( true )
for(;;)
{
int c;
c = waitKey(10);

View File

@@ -22,14 +22,14 @@ Mat src; Mat dst;
char window_name[] = "Smoothing Demo";
/// Function headers
int display_caption( char* caption );
int display_caption( const char* caption );
int display_dst( int delay );
/**
* function main
*/
int main( int argc, char** argv )
int main( void )
{
namedWindow( window_name, CV_WINDOW_AUTOSIZE );
@@ -84,7 +84,7 @@ int main( int argc, char** argv )
/**
* @function display_caption
*/
int display_caption( char* caption )
int display_caption( const char* caption )
{
dst = Mat::zeros( src.size(), src.type() );
putText( dst, caption,

View File

@@ -20,10 +20,10 @@ int const max_type = 4;
int const max_BINARY_value = 255;
Mat src, src_gray, dst;
char* window_name = "Threshold Demo";
const char* window_name = "Threshold Demo";
char* trackbar_type = "Type: \n 0: Binary \n 1: Binary Inverted \n 2: Truncate \n 3: To Zero \n 4: To Zero Inverted";
char* trackbar_value = "Value";
const char* trackbar_type = "Type: \n 0: Binary \n 1: Binary Inverted \n 2: Truncate \n 3: To Zero \n 4: To Zero Inverted";
const char* trackbar_value = "Value";
/// Function headers
void Threshold_Demo( int, void* );
@@ -31,7 +31,7 @@ void Threshold_Demo( int, void* );
/**
* @function main
*/
int main( int argc, char** argv )
int main( int, char** argv )
{
/// Load an image
src = imread( argv[1], 1 );
@@ -55,7 +55,7 @@ int main( int argc, char** argv )
Threshold_Demo( 0, 0 );
/// Wait until user finishes program
while(true)
for(;;)
{
int c;
c = waitKey( 20 );