Home > Source > Helper > poor_linear_warp.m

poor_linear_warp

PURPOSE ^

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

SYNOPSIS ^

function points = poor_linear_warp(points, lo, hi, ref_lo, ref_hi, image_width, error)

DESCRIPTION ^

 ==============================================================
 POOR_LINEAR_WARP: Perform a poor linear warp.

 Code written by Katherine Smith, 2003

    GENERAL

      new_images = average_smooth(images, window)

    INPUT/S

      -points:
           The points before warping

      -lo:
           ?

      -hi:
           ?

      -ref_lo:
           ?

      -ref_hi:
           ?

      -image_width:
           The width of the image to be warped.

      -error:
           ??
           
    OUTPUT/S

      -points:
           The points after warping

    PENDING WORK

      -Find out about the different inputs
      -Understand code and add comments.

    KNOWN BUG/S

      -None.

    COMMENT/S

      -Currently not used??

    RELATED FUNCTION/S

      LINEAR_WARP

    ABOUT

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

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function points = poor_linear_warp(points, lo, hi, ref_lo, ref_hi, image_width, error)
0002 % ==============================================================
0003 % POOR_LINEAR_WARP: Perform a poor linear warp.
0004 %
0005 % Code written by Katherine Smith, 2003
0006 %
0007 %    GENERAL
0008 %
0009 %      new_images = average_smooth(images, window)
0010 %
0011 %    INPUT/S
0012 %
0013 %      -points:
0014 %           The points before warping
0015 %
0016 %      -lo:
0017 %           ?
0018 %
0019 %      -hi:
0020 %           ?
0021 %
0022 %      -ref_lo:
0023 %           ?
0024 %
0025 %      -ref_hi:
0026 %           ?
0027 %
0028 %      -image_width:
0029 %           The width of the image to be warped.
0030 %
0031 %      -error:
0032 %           ??
0033 %
0034 %    OUTPUT/S
0035 %
0036 %      -points:
0037 %           The points after warping
0038 %
0039 %    PENDING WORK
0040 %
0041 %      -Find out about the different inputs
0042 %      -Understand code and add comments.
0043 %
0044 %    KNOWN BUG/S
0045 %
0046 %      -None.
0047 %
0048 %    COMMENT/S
0049 %
0050 %      -Currently not used??
0051 %
0052 %    RELATED FUNCTION/S
0053 %
0054 %      LINEAR_WARP
0055 %
0056 %    ABOUT
0057 %
0058 %      -Created:     November 23rd, 2003
0059 %      -Last update: Novermber 26th, 2003
0060 %      -Revision:    0.0.3
0061 %      -Author:      R. S. Schestowitz, University of Manchester
0062 % ==============================================================
0063 
0064 
0065 if ((hi - lo)<=0) 
0066   disp('Invalid values of high and low. Low must be lower than high');
0067   return; % break out of function
0068 end
0069 
0070 % NOTE: identical to simple warp. Perhaps functions should be merged and have an extra
0071 %       argument regarding complexity as in strategy pattern.
0072 
0073 % Smith: line up the edge points, do linear stretch in between!
0074 % but get them off by a amount determined by error
0075 
0076 ref_lo = floor(ref_lo - error*rand);
0077 ref_hi = ceil(ref_hi + error*rand);
0078 
0079 % first section - between 1 and lo
0080 %scale_factor1 = (ref_lo-1)/(lo-1);
0081 scale_factor1 = (lo-1)/(ref_lo-1);
0082 points(:,1:ref_lo) = (points(:,1:ref_lo)-1)*scale_factor1 + 1;
0083 
0084 % second section
0085 if(ref_hi-ref_lo ~= 0)
0086   scale_factor2 = (hi - lo)/(ref_hi-ref_lo);
0087 else
0088   scale_factor2 = 0;
0089 end
0090 points(:,ref_lo+1:ref_hi-1) = (points(:,ref_lo+1:ref_hi-1) - ref_lo)*scale_factor2 + lo;
0091 %scale_factor2 = (ref_hi - ref_lo)/(hi-lo);
0092 %points(:,lo+1:hi-1) = (points(:,lo+1:hi-1) - lo)*scale_factor2 + ref_lo;
0093 
0094 % third section
0095 scale_factor3 = (image_width-hi)/(image_width-ref_hi);
0096 points(:,ref_hi:image_width) = ...
0097   (points(:,ref_hi:image_width) - ref_hi)*scale_factor3 + hi;
0098 %scale_factor3 = (image_width-ref_hi)/(image_width-hi);
0099 %points(:,hi:image_width) = ...
0100 %  (points(:,hi:image_width) - hi)*scale_factor3 + ref_hi;

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