int top, bottom, left, right;
int borderType = BORDER_CONSTANT;
const char* window_name = "copyMakeBorder Demo";
int main(
int argc,
char** argv )
{
const char* imageName = argc >=2 ? argv[1] : "lena.jpg";
src = imread( samples::findFile( imageName ), IMREAD_COLOR );
printf(" 打开图像出错\n");
printf(" 程序参数:[图像名称 -- 默认 lena.jpg] \n");
return -1;
}
printf( "\n \t copyMakeBorder 演示: \n" );
printf( "\t -------------------- \n" );
printf( " ** 按'c'键将边界设置为随机常数值 \n");
printf( " ** 按'r'键将边界设置为复制模式 \n");
printf( " ** 按'ESC'键退出程序 \n");
namedWindow( window_name, WINDOW_AUTOSIZE );
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 );
imshow( window_name, dst );
char c = (char)waitKey(500);
if( c == 27 )
{ break; }
else if( c == 'c' )
else if( c == 'r' )
}
return 0;
}
bool empty() const
如果数组没有元素,则返回true。
int rows
行和列的数量,当矩阵的维度超过2维时为(-1, -1)
定义 mat.hpp:2155
@ BORDER_REPLICATE
aaaaaa|abcdefgh|hhhhhhh
定义 base.hpp:270
@ BORDER_CONSTANT
iiiiii|abcdefgh|iiiiiii 带有一些指定的i
定义 base.hpp:269
int main(int argc, char *argv[])
定义 highgui_qt.cpp:3