Backprojection
Fig. 1: Input image (left); sinogram (middle); backprojected image (right).
The goal of this exercise is to implement projection and backprojection algorithms and use them to reconstruct an image from a finite number of projections.
A well-known application of this principle is image reconstruction in computed tomography (CT).
Projection
Start by creating an input image similar to the one shown in Fig. 1 (left). You may also create a different test image if you prefer.
Next, compute projections of the input image for a set of angles in the interval using a step of .
A projection is obtained by summing the pixel brightness values along parallel lines. Note that these sums can be greater than , so choose an appropriate data type for the cv::Mat used to store the projection values.
A single projection forms a one-dimensional vector.
Computing projections directly for many different angles would be inconvenient. Instead, use a simple approach:
- Rotate the input image by the required angle.
- Compute the projection of the rotated image along the -axis.
- Store the resulting projection vector.
Repeating this procedure for all angles produces a set of projection vectors. These vectors can be arranged as rows or columns of a two-dimensional image called a sinogram (see Fig. 1, middle).
Backprojection
The original image can be approximately reconstructed from the set of projections using backprojection.
For each projection:
- Take the one-dimensional projection vector.
- Create an image in which this vector is copied repeatedly across the image.
- Rotate the resulting image back by the angle at which the corresponding projection was acquired.
- Add the rotated image to an accumulation image.
After processing all projections, the accumulated pixel values form the backprojected image.
The result is shown in Fig. 1 (right). Notice the clearly visible circular structure and the characteristic blurring caused by simple, unfiltered backprojection.