opencv在matlab中是否具有类似于size和bwperim的函数?

时间:2010-03-24 06:49:53

标签: c++ matlab opencv matlab-engine matlab-deployment

我是opencv的新手,擅长matlab

我想将下面的equalent写成opencv

[毫米,NN] =尺寸(binaryimage);

bwperim(binaryimage);

请任何人帮忙

2 个答案:

答案 0 :(得分:2)

答案 1 :(得分:0)

为了模仿bwperim你可以做

Mat m;
Mat dilated = m.clone(); dilate(dilated,one_pixel_wide_element);
Mat output = dilated - m;

可以构建one_pixel_wide_element using instructions from opencv

  dilation_type = MORPH_RECT;
  dilation_size = 1;
  Mat element = getStructuringElement( dilation_type,
                  Size( 2*dilation_size + 1, 2*dilation_size+1 ),
                  Point( dilation_size, dilation_size ) );

这给出了外边界。对于内部边界,侵蚀(和m-eroded)。