Home > Source > Helper > perturb_points.m

perturb_points

PURPOSE ^

==============================================================

SYNOPSIS ^

function points = perturb_points(points, variance)

DESCRIPTION ^

 ==============================================================
 PERTURB_POINTS: Perturbs the points in an image.

 Code written by Katherine Smith, 2003

    GENERAL

      points = perturb_points(points, variance)

    INPUT/S

      -points:
           The points in their original (initial) position.

      -variance:
           The variance allowed for perturbation.
           
    OUTPUT/S

      -points:
           The points after they have been perturbed.

    PENDING WORK

      -

    KNOWN BUG/S

      -None.

    COMMENT/S

      -

    RELATED FUNCTION/S

      

    ABOUT

      -Created:     November 23rd, 2003
      -Last update: Novermber 26th, 2003
      -Revision:    0.0.2
      -Author:      R. S. Schestowitz, University of Manchester
 ==============================================================

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function points = perturb_points(points, variance)
0002 % ==============================================================
0003 % PERTURB_POINTS: Perturbs the points in an image.
0004 %
0005 % Code written by Katherine Smith, 2003
0006 %
0007 %    GENERAL
0008 %
0009 %      points = perturb_points(points, variance)
0010 %
0011 %    INPUT/S
0012 %
0013 %      -points:
0014 %           The points in their original (initial) position.
0015 %
0016 %      -variance:
0017 %           The variance allowed for perturbation.
0018 %
0019 %    OUTPUT/S
0020 %
0021 %      -points:
0022 %           The points after they have been perturbed.
0023 %
0024 %    PENDING WORK
0025 %
0026 %      -
0027 %
0028 %    KNOWN BUG/S
0029 %
0030 %      -None.
0031 %
0032 %    COMMENT/S
0033 %
0034 %      -
0035 %
0036 %    RELATED FUNCTION/S
0037 %
0038 %
0039 %
0040 %    ABOUT
0041 %
0042 %      -Created:     November 23rd, 2003
0043 %      -Last update: Novermber 26th, 2003
0044 %      -Revision:    0.0.2
0045 %      -Author:      R. S. Schestowitz, University of Manchester
0046 % ==============================================================
0047 
0048 perturbation = zeros(size(points)); 
0049                   % initialise all to 0, i.e. 0 change
0050                   % Smith: don't warp the first or the last
0051 perturbation(2:size(points)-1,:) = randn(size(points,1)-2,1) * variance; 
0052                   % pertub w.r.t. variance. It defines the weight of the possible
0053                   % random permutations.
0054 points = points + perturbation; 
0055                   % apply perturbation to points by simple summation
0056                   % Smith: resort in case any of the points have crossed over each other
0057 points = sort(points);
0058                   % Note: there is a function that checks of points have crossed over
0059                   % elsewhere in Kate's code.
0060 points = normalise_to_bounds(points, 1,size(points,1));
0061                   % normalise in case any have gone out of bounds (I think below 0 and above 1)

Generated on Thu 13-May-2004 18:00:46 by m2html © 2003