Accelerating the pace of engineering and science

# Documentation Center

• Trial Software

### Contents

 Note   For information about creating projection data from line integrals along paths that radiate from a single source, called fan-beam projections, see Fan-Beam Projection Data. To convert parallel-beam projection data to fan-beam projection data, use the para2fan function.

The radon function computes projections of an image matrix along specified directions.

A projection of a two-dimensional function f(x,y) is a set of line integrals. The radon function computes the line integrals from multiple sources along parallel paths, or beams, in a certain direction. The beams are spaced 1 pixel unit apart. To represent an image, the radon function takes multiple, parallel-beam projections of the image from different angles by rotating the source around the center of the image. The following figure shows a single projection at a specified rotation angle.

Parallel-Beam Projection at Rotation Angle Theta

For example, the line integral of f(x,y) in the vertical direction is the projection of f(x,y) onto the x-axis; the line integral in the horizontal direction is the projection of f(x,y) onto the y-axis. The following figure shows horizontal and vertical projections for a simple two-dimensional function.

Horizontal and Vertical Projections of a Simple Function

Projections can be computed along any angle [[THETA]]. In general, the Radon transform of f(x,y) is the line integral of f parallel to the y´-axis

where

The following figure illustrates the geometry of the Radon transform.

You can compute the Radon transform of an image I for the angles specified in the vector theta using the radon function with this syntax.

[R,xp] = radon(I,theta);


The columns of R contain the Radon transform for each angle in theta. The vector xp contains the corresponding coordinates along the x′-axis. The center pixel of I is defined to be floor((size(I)+1)/2); this is the pixel on the x′-axis corresponding to .

The commands below compute and plot the Radon transform at 0° and 45° of an image containing a single square object. xp is the same for all projection angles.

I = zeros(100,100);
I(25:75, 25:75) = 1;
imshow(I)
figure; plot(xp,R(:,1)); title('R_{0^o} (x\prime)')

Radon Transform of a Square Function at 0 Degrees

figure; plot(xp,R(:,2)); title('R_{45^o} (x\prime)')

Radon Transform of a Square Function at 45 Degrees

### Viewing the Radon Transform as an Image

The Radon transform for a large number of angles is often displayed as an image. In this example, the Radon transform for the square image is computed at angles from 0° to 180°, in 1° increments.

theta = 0:180;
imagesc(theta,xp,R);
title('R_{\theta} (X\prime)');
xlabel('\theta (degrees)');
ylabel('X\prime');
set(gca,'XTick',0:20:180);
colormap(hot);
colorbar

### Detecting Lines Using the Radon Transform

The Radon transform is closely related to a common computer vision operation known as the Hough transform. You can use the radon function to implement a form of the Hough transform used to detect straight lines. The steps are

1. Compute a binary edge image using the edge function.

I = fitsread('solarspectra.fts');
I = mat2gray(I);
BW = edge(I);
imshow(I), figure, imshow(BW)

2. Compute the Radon transform of the edge image.

theta = 0:179;
figure, imagesc(theta, xp, R); colormap(hot);
xlabel('\theta (degrees)'); ylabel('x\prime');
title('R_{\theta} (x\prime)');
colorbar

Radon Transform of an Edge Image

3. Find the locations of strong peaks in the Radon transform matrix. The locations of these peaks correspond to the locations of straight lines in the original image.

In the following figure, the strongest peaks in R correspond to and . The line perpendicular to that angle and located at is shown below, superimposed in red on the original image. The Radon transform geometry is shown in black. Notice that the other strong lines parallel to the red line also appear as peaks at in the transform. Also, the lines perpendicular to this line appear as peaks at .

Radon Transform Geometry and the Strongest Peak (Red)