#include "opencv2/imgproc.hpp"
#include "opencv2/imgcodecs.hpp"
#include "opencv2/highgui.hpp"
int top, bottom, left, right;
const char* window_name = "copyMakeBorder Demo";
int main( int argc, char** argv )
{
const char* imageName = argc >=2 ? argv[1] : "../data/lena.jpg";
printf(" Error opening image\n");
printf(" Program Arguments: [image_name -- default ../data/lena.jpg] \n");
return -1;
}
printf( "\n \t copyMakeBorder Demo: \n" );
printf( "\t -------------------- \n" );
printf( " ** Press 'c' to set the border to a random constant value \n");
printf( " ** Press 'r' to set the border to be replicated \n");
printf( " ** Press 'ESC' to exit the program \n");
top = (int) (0.05*src.
rows); bottom = top;
left = (int) (0.05*src.
cols); right = left;
for(;;)
{
Scalar value( rng.uniform(0, 255), rng.uniform(0, 255), rng.uniform(0, 255) );
copyMakeBorder( src, dst, top, bottom, left, right, borderType, value );
if( c == 27 )
{ break; }
else if( c == 'c' )
else if( c == 'r' )
}
return 0;
}