1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-29 07:13:02 +04:00

Update documentation ( tutorials )

This commit is contained in:
Suleyman TURKMEN
2016-07-18 16:32:05 +03:00
parent 55d0945149
commit bb6f65c199
34 changed files with 369 additions and 1333 deletions
@@ -10,12 +10,13 @@
using namespace cv;
/// Global Variables
//![variables]
Mat src, dst;
int top, bottom, left, right;
int borderType;
const char* window_name = "copyMakeBorder Demo";
RNG rng(12345);
//![variables]
/**
* @function main
@@ -25,14 +26,15 @@ int main( int, char** argv )
int c;
/// Load an image
src = imread( argv[1], IMREAD_COLOR );
//![load]
src = imread( argv[1], IMREAD_COLOR ); // Load an image
if( src.empty() )
{
printf(" No data entered, please enter the path to an image file \n");
return -1;
}
//![load]
/// Brief how-to for this program
printf( "\n \t copyMakeBorder Demo: \n" );
@@ -41,18 +43,22 @@ int main( int, char** argv )
printf( " ** Press 'r' to set the border to be replicated \n");
printf( " ** Press 'ESC' to exit the program \n");
/// Create window
//![create_window]
namedWindow( window_name, WINDOW_AUTOSIZE );
//![create_window]
//![init_arguments]
/// Initialize arguments for the filter
top = (int) (0.05*src.rows); bottom = (int) (0.05*src.rows);
left = (int) (0.05*src.cols); right = (int) (0.05*src.cols);
dst = src;
//![init_arguments]
dst = src;
imshow( window_name, dst );
for(;;)
{
//![check_keypress]
c = waitKey(500);
if( (char)c == 27 )
@@ -61,11 +67,19 @@ int main( int, char** argv )
{ borderType = BORDER_CONSTANT; }
else if( (char)c == 'r' )
{ borderType = BORDER_REPLICATE; }
//![check_keypress]
//![update_value]
Scalar value( rng.uniform(0, 255), rng.uniform(0, 255), rng.uniform(0, 255) );
copyMakeBorder( src, dst, top, bottom, left, right, borderType, value );
//![update_value]
//![copymakeborder]
copyMakeBorder( src, dst, top, bottom, left, right, borderType, value );
//![copymakeborder]
//![display]
imshow( window_name, dst );
//![display]
}
return 0;