-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathExternalForceImage2D.m
More file actions
executable file
·29 lines (24 loc) · 960 Bytes
/
Copy pathExternalForceImage2D.m
File metadata and controls
executable file
·29 lines (24 loc) · 960 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
function Eextern = ExternalForceImage2D(I,Wline, Wedge, Wterm,Sigma)
% Eextern = ExternalForceImage2D(I,Wline, Wedge, Wterm,Sigma)
%
% inputs,
% I : The image
% Sigma : Sigma used to calculated image derivatives
% Wline : Attraction to lines, if negative to black lines otherwise white
% lines
% Wedge : Attraction to edges
% Wterm : Attraction to terminations of lines (end points) and corners
%
% outputs,
% Eextern : The energy function described by the image
%
% Function is written by D.Kroon University of Twente (July 2010)
Ix=ImageDerivatives2D(I,Sigma,'x');
Iy=ImageDerivatives2D(I,Sigma,'y');
Ixx=ImageDerivatives2D(I,Sigma,'xx');
Ixy=ImageDerivatives2D(I,Sigma,'xy');
Iyy=ImageDerivatives2D(I,Sigma,'yy');
Eline = imgaussian(I,Sigma);
Eterm = (Iyy.*Ix.^2 -2*Ixy.*Ix.*Iy + Ixx.*Iy.^2)./((1+Ix.^2 + Iy.^2).^(3/2));
Eedge = sqrt(Ix.^2 + Iy.^2);
Eextern= (Wline*Eline - Wedge*Eedge -Wterm * Eterm);