📄 ac_area.m
字号:
function acarea = ac_area(acontour)
%ac_area: signed area of an active contour
% r = ac_area(a) computes the signed area, r, of an active contour, a, using
% the Green's theorem. If a is oriented counterclockwise, r is positive.
%
%See also po_orientation, acontour.
%
%Active Contour Toolbox by Eric Debreuve
%Last update: June 20, 2006
acarea = 0;
for subac_idx = 1:length(acontour)
[breaks, coefs, interval] = ppbrk(acontour(subac_idx), 'breaks', 'coefs', 'interval');
%/!\ this might not be valid if the ppform structure changes
first_coordinate = mkpp(breaks, coefs(1:2:end,:));
second_coordinate = mkpp(breaks, coefs(2:2:end,:));
acarea = acarea + 0.5 * fnval(fnint(...
fncmb(...
fncmb(first_coordinate, '*', fnder(second_coordinate)), ...
'-', ...
fncmb(second_coordinate, '*', fnder(first_coordinate))...
)), interval(2));
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -