SWEEPMATRIX precalulates the x and y coordinates for the ray pixels used in CIRCSWEEP. SWEEPMATRIX sets up the matrices which when cropped properly can be directly used by CIRCSWEEP to find the ray sum results. The main use for this function is to improve computational efficiency. USAGE: [sweepmatx,sweepmaty]=sweepmatrix(img) INPUTS: img: image (the main concern is the size of the image OUTPUTS: sweepmatx: x coordinate sweep matrix, each column corresponds to the x coordinates of the pixels that lie under a ray of a certain angle. Angles increase progressively from 0 to 360 along dimension 2 of the array. sweepmaty: y coordinate sweep matrix, each column corresponds to the y coordinates of the pixels that lie under a ray of a certain angle.
0001 function [sweepmatx,sweepmaty]=sweepmatrix(img) 0002 % SWEEPMATRIX precalulates the x and y coordinates for the ray pixels used in CIRCSWEEP. 0003 % 0004 % SWEEPMATRIX sets up the matrices which when cropped properly can be 0005 % directly used by CIRCSWEEP to find the ray sum results. The main use for 0006 % this function is to improve computational efficiency. 0007 % 0008 % USAGE: 0009 % [sweepmatx,sweepmaty]=sweepmatrix(img) 0010 % 0011 % INPUTS: 0012 % img: image (the main concern is the size of the image 0013 % 0014 % OUTPUTS: 0015 % sweepmatx: x coordinate sweep matrix, each column corresponds to the 0016 % x coordinates of the pixels that lie under a ray of a certain angle. 0017 % Angles increase progressively from 0 to 360 along dimension 2 of the 0018 % array. 0019 % 0020 % sweepmaty: y coordinate sweep matrix, each column corresponds to the 0021 % y coordinates of the pixels that lie under a ray of a certain angle. 0022 0023 theta=pi()/90:pi()/90:2*pi(); 0024 win=min(size(img)); 0025 r=1:win; 0026 % get grids 0027 [thetag,rg]=meshgrid(theta,r); 0028 sweepmatx=round(rg.*cos(thetag)); 0029 sweepmaty=round(rg.*sin(thetag));