📄 extract_region_reg.m
字号:
function [Boundary, Area] = Extract_region (Image_given, Min_area)
% Extract_region - given Initial_value (a pixel close to the actual
% boundary of a segment), and Image containing the segment,
% outputs the supposed boundary of the piece (not necessarily connected)
% by finding the connected component containing the given point first,
% and finding the perimeter of the piece second
[Rows_i, Cols_i] = size(Image_given);
Enclosing = zeros(Rows_i+2, Cols_i+2);
Enclosing(2:Rows_i+1, 2:Cols_i+1) = Image_given;
Area = bwarea(Enclosing);
if Area < Min_area
Boundary = 0;
return;
end
Boundary = bwperim(Enclosing);
[Rows, Cols] = find(Boundary);
Boundary = [Rows'; Cols'];
Boundary = Boundary-ones(size(Boundary));
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -