circsweep

PURPOSE ^

CIRCSWEEP sums the intensity of the input image along rays at all angles.

SYNOPSIS ^

function [theta,values,thetasmd,valuessmd]=circsweep(img,x,y)

DESCRIPTION ^

 CIRCSWEEP sums the intensity of the input image along rays at all angles.
 
 CIRCSWEEP sums the intensity pixels lying along a ray at a certain angle.
 This is done for all angles. The outputs theta and values correspond to
 the summation with the rays going from 0 to 360 degrees from the centre
 of the image to the border. The other two outputs correspond to the 
 summation along the entire ray passing through the centre with the angles
 going from 0 to 180.
 
 USAGE:
     [theta,values,thetasmd,valuessmd]=circsweep(img,x,y);
 
 INPUTS:
     img: input grayscale image of class double
 
     x: the x coordinates of the pixels, this is fed from the output of
     SWEEPMATRIX
 
     y: the y coordinates of the pixels, this is fed from the output of
     SWEEPMATRIX
 
 OUTPUTS:
     theta: angles from 0 to 360
 
     values: the sum of intensity values from centre to border
 
     thetasmd: angles from 0 to 180
 
     valuessmd: the sum of intensity values from border to border along
     the centre of the image

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [theta,values,thetasmd,valuessmd]=circsweep(img,x,y)
0002 % CIRCSWEEP sums the intensity of the input image along rays at all angles.
0003 %
0004 % CIRCSWEEP sums the intensity pixels lying along a ray at a certain angle.
0005 % This is done for all angles. The outputs theta and values correspond to
0006 % the summation with the rays going from 0 to 360 degrees from the centre
0007 % of the image to the border. The other two outputs correspond to the
0008 % summation along the entire ray passing through the centre with the angles
0009 % going from 0 to 180.
0010 %
0011 % USAGE:
0012 %     [theta,values,thetasmd,valuessmd]=circsweep(img,x,y);
0013 %
0014 % INPUTS:
0015 %     img: input grayscale image of class double
0016 %
0017 %     x: the x coordinates of the pixels, this is fed from the output of
0018 %     SWEEPMATRIX
0019 %
0020 %     y: the y coordinates of the pixels, this is fed from the output of
0021 %     SWEEPMATRIX
0022 %
0023 % OUTPUTS:
0024 %     theta: angles from 0 to 360
0025 %
0026 %     values: the sum of intensity values from centre to border
0027 %
0028 %     thetasmd: angles from 0 to 180
0029 %
0030 %     valuessmd: the sum of intensity values from border to border along
0031 %     the centre of the image
0032 
0033 
0034 win=floor(size(img,1)/2);
0035 cen=win+1;
0036 
0037 theta=pi()/90:pi()/90:2*pi();
0038 
0039 
0040 x=x+cen;
0041 y=y+cen;
0042 xn=find(x<1 | x>size(img,1));
0043 yn=find(y<1 | y>size(img,2));
0044 xn=xn';
0045 yn=yn';
0046 
0047 x(xn)=1;
0048 y(yn)=1;
0049 
0050 indcs=sub2ind(size(img),x,y);
0051 values=img(indcs);
0052 values([xn,yn])=0;
0053 values=mean(values);
0054 n180=length(theta)/2;
0055 thetasmd=theta(1:n180);
0056 valuessmd=(values(1:n180)+values(n180+1:length(theta)))/2;

Generated on Sun 04-Apr-2010 17:13:59 by m2html © 2005