============================================================== LINEAR_WARP: Apply a linear warp to the points. Code written by Katherine Smith, 2003 GENERAL linear_warp(points, lo, hi, ref_lo, ref_hi) INPUT/S -points: The points before warping -lo: ? -hi: ? -ref_lo: ? -ref_hi: ? OUTPUT/S -points: The points after warping PENDING WORK - KNOWN BUG/S -None. COMMENT/S - RELATED FUNCTION/S POOR_LINEAR_WARP ABOUT -Created: November 23rd, 2003 -Last update: Novermber 25th, 2003 -Revision: 0.0.2 -Author: R. S. Schestowitz, University of Manchester ==============================================================
0001 function points = linear_warp(points, lo, hi, ref_lo, ref_hi) 0002 % ============================================================== 0003 % LINEAR_WARP: Apply a linear warp to the points. 0004 % 0005 % Code written by Katherine Smith, 2003 0006 % 0007 % GENERAL 0008 % 0009 % linear_warp(points, lo, hi, ref_lo, ref_hi) 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 % OUTPUT/S 0029 % 0030 % -points: 0031 % The points after warping 0032 % 0033 % PENDING WORK 0034 % 0035 % - 0036 % 0037 % KNOWN BUG/S 0038 % 0039 % -None. 0040 % 0041 % COMMENT/S 0042 % 0043 % - 0044 % 0045 % RELATED FUNCTION/S 0046 % 0047 % POOR_LINEAR_WARP 0048 % 0049 % ABOUT 0050 % 0051 % -Created: November 23rd, 2003 0052 % -Last update: Novermber 25th, 2003 0053 % -Revision: 0.0.2 0054 % -Author: R. S. Schestowitz, University of Manchester 0055 % ============================================================== 0056 0057 image_width = max(points); 0058 % get the maximum of points. Why is that width?? 0059 if ((hi - lo)<=0) 0060 disp('Invalid values of high and low. Low must be lower than high'); 0061 return; % break out of function 0062 end 0063 % Smith: line up the edge points, do linear stretch in between! 0064 0065 % RSS: The following 3 sections are quite mysterious. They implement 0066 % a warp in some way. 0067 0068 % Smith: first section - between 1 and lo 0069 %scale_factor1 = (ref_lo-1)/(lo-1); 0070 scale_factor1 = (lo-1)/(ref_lo-1); 0071 points(1:ref_lo,:) = (points(1:ref_lo,:)-1)*scale_factor1 + 1; 0072 0073 % Smith: second section 0074 scale_factor2 = (hi - lo)/(ref_hi-ref_lo); 0075 points(ref_lo+1:ref_hi-1,:) = (points(ref_lo+1:ref_hi-1,:) - ref_lo)*scale_factor2 + lo; 0076 %scale_factor2 = (ref_hi - ref_lo)/(hi-lo); 0077 %points(:,lo+1:hi-1) = (points(:,lo+1:hi-1) - lo)*scale_factor2 + ref_lo; 0078 0079 % Smith: third section 0080 scale_factor3 = (image_width-hi)/(image_width-ref_hi); 0081 points(ref_hi:image_width,:) = ... 0082 (points(ref_hi:image_width,:) - ref_hi)*scale_factor3 + hi; 0083 %scale_factor3 = (image_width-ref_hi)/(image_width-hi); 0084 %points(:,hi:image_width) = ... 0085 % (points(:,hi:image_width) - hi)*scale_factor3 + ref_hi;