No BSD License
Highlights from
GeoML
-
GeoML: intro
-
ATE_EdgeDistance(varargin)
ATE_EDGEDISTANCE Computes the energy using the distance from edges.
-
ATE_GradientNorm(varargin)
ATE_GRADIENTNORM Computes the energy using the norm of gradient.
-
ATOptimize(img,model,free,Eex...
ATOPTIMIZE Optimizes a shape model over an image.
-
GeoMLConvertToTree(model,visi...
GEOMLCONVERTTOTREE Converts a tree containing a model.
-
GeoMLGenerateTree(model,visib...
GEOMLGENERATETREE Generates a tree containing a model.
-
GeoMLIterate(model,join,mode)
GEOMLITERATE Iterate on a model.
-
GeoMLParseModel(modelname)
GEOMLPARSEMODEL Parsing of a GeoML XML model description.
-
gauss(x, sigma, mu, norm)
GAUSS Return the monodimensional gaussian function
-
gaussianFilter(varargin)
GAUSSIANFILTER Filters an image using the gaussian derivative filter
-
impixels(img,P)
IMPIXELS Get the values of image pixels at defined points.
-
imscale(img, range)
IMSCALE Scale an image to fit the range
-
imtype(img, type)
IMTYPE Chenges the type of an image
-
plotpoints(X,symbol)
PLOTPOINTS This function allow to plot a series of points
-
plotshape(X, closed, symbol)
PLOTSHAPE This function allow to plot a single shape
-
points2dnormalize(Pi,mustRemo...
POINTS2DNORMALIZE Normalize 2d points
-
points2domogenize(Pi)
POINTS2DOMOGENIZE Enshure a 3-coords omogeneous set of points
-
View all files
from
GeoML
by Gabriele Lombardi
A general morphable template tool for image segmentation.
|
| ATE_GradientNorm(varargin) |
function varargout = ATE_GradientNorm(varargin)
% ATE_GRADIENTNORM Computes the energy using the norm of gradient.
%
% This function computes the gradient and uses the sum of the gadient norm
% as energy.
%
% INITIALIZATION:
%
% Params
% ------
% IN:
% img = The image.
% fedge = The edge function.
% OUT:
% ngrad = The norms of the gradients.
% At least one argument is required:
if nargin<1
error('At least one argument is required!');
end
% Check the type of call:
if numel(varargin{1})==1 && varargin{1}==0
% Call the init function:
varargout{:} = InitEnvironment(varargin{2:end});
else
% Call the evaluate function:
varargout{:} = ComputeEnergy(varargin{:});
end
% ------------------------ LOCAL FUNCTIONS ------------------------
% The init function:
function ngrad = InitEnvironment(img)
% Check params:
if nargin<1
error('An image is requred for the initialization!');
end
% Get a gray double image:
img = imtype(img,'gF');
% Computing the gradient:
[gradx,grady] = gradient(img);
% Computing the norm of the gradient:
ngrad = gradx.^2 + grady.^2;
% Computing the final energy map:
ngrad = -imscale(ngrad);
% -----------------------------------------------------------------
% The evaluation function:
function E = ComputeEnergy(pts,ngrad)
% The energy is the sum of the gradient's norm:
E = sum(impixels(ngrad,pts))/size(pts,2);
|
|
Contact us at files@mathworks.com