============================================================== APPLY_PERTURBATION_TO_POINTS: Apply noise to (correct) warp GENERAL points= apply_perturbation_to_points (points, offset_extent) INPUT/S -points The points defining the CPS warp -offset entent Defines the amount of noise/distortion -perturbation_method The method of applying the change OUTPUT/S -points The points after offset application PENDING WORK - KNOWN BUG/S - COMMENT/S - RELATED FUNCTION/S ABOUT -Created: March 10th, 2004 -Last update: April 11st, 2004 -Revision: 0.0.6 -Author: R. S. Schestowitz, University of Manchester ==============================================================
0001 function points = apply_perturbation_to_points (points, offset_extent, perturbation_method) 0002 % ============================================================== 0003 % APPLY_PERTURBATION_TO_POINTS: Apply noise to (correct) warp 0004 % 0005 % 0006 % GENERAL 0007 % 0008 % points= apply_perturbation_to_points (points, offset_extent) 0009 % 0010 % INPUT/S 0011 % 0012 % -points 0013 % The points defining the CPS warp 0014 % 0015 % -offset entent 0016 % Defines the amount of noise/distortion 0017 % 0018 % -perturbation_method 0019 % The method of applying the change 0020 % 0021 % OUTPUT/S 0022 % 0023 % -points 0024 % The points after offset application 0025 % 0026 % PENDING WORK 0027 % 0028 % - 0029 % 0030 % KNOWN BUG/S 0031 % 0032 % - 0033 % 0034 % COMMENT/S 0035 % 0036 % - 0037 % 0038 % RELATED FUNCTION/S 0039 % 0040 % 0041 % 0042 % ABOUT 0043 % 0044 % -Created: March 10th, 2004 0045 % -Last update: April 11st, 2004 0046 % -Revision: 0.0.6 0047 % -Author: R. S. Schestowitz, University of Manchester 0048 % ============================================================== 0049 0050 0051 if (strcmp(perturbation_method, 'random noise')), 0052 for i=1:size(points,2), 0053 points(i) = points(i) + offset_extent * (rand - 0.5) * 0.1; 0054 % if (points(i) < 0), 0055 % points(i) = 0; 0056 % % make 0 a lower boundary 0057 % end 0058 % points = average_smooth(points,5); 0059 end 0060 0061 0062 elseif (strcmp(perturbation_method, 'CPS warp')), 0063 % warp_params.green = 'biharmCPS'; 0064 % initial_warp_points = [0.1,0.2,0.3,0.4]; 0065 % shifted_warp_points = f(initial_warp_points) 0066 % points = nrr_trans_1d(points, initial_warp_points, shifted_warp_points, warp_params, []); 0067 centre = 0.5 + rand * 0.1; % 0.1 * offset_extent * rand; 0068 % offset extend should preferably lie in the range of 1-10 0069 radius = 0.3; % 0.4 - (abs(centre - 0.5) * 2); 0070 % this chooses high legal radius 0071 points = cps_warp_1d(points, centre, radius, 0.5 * rand); 0072 0073 else 0074 error('Unknown perturbation method'); 0075 end