www.gusucode.com > images 案例代码 matlab源码程序 > images/PlotTheRadonTransformExample.m

    %% Plot the Radon Transform of an Image
% This example shows how to compute the Radon transform of an image, |I|,
% for a specific set of angles, |theta|, using the |radon| function. The
% function returns, |R|, in which the columns contain the Radon transform for
% each angle in |theta|. The function also returns the vector, |xp| , which
% contains the corresponding coordinates along the x-axis. The center pixel
% of |I| is defined to be |floor((size(I)+1)/2)|, which is the pixel on the
% x-axis corresponding to _x' = 0_.
%%
% Create a small sample image for this example that consists of a single
% square object and display it.
I = zeros(100,100);
I(25:75,25:75) = 1;
imshow(I)
%%
% Calculate the Radon transform of the image for the angles 0 degrees and
% 45 degrees.
[R,xp] = radon(I,[0 45]);
%%
% Plot the transform for 0 degrees.
figure
plot(xp,R(:,1));
title('Radon Transform of a Square Function at 0 degrees')
%% 
% Plot the transform for 45 degrees.
figure
plot(xp,R(:,2)); 
title('Radon Transform of a Square Function at 45 degrees')