how to get MTF of camera using star target

50 views (last 30 days)
josh sol
josh sol on 9 Feb 2022
Answered: Abhimenyu on 31 Jan 2024
i am trying to get an MTF graph for a camera and i need to do it using a 'simon star' target.
i understand that i need to do that by getting the values of the image at different radius and then calculating the frequency according to the radius, but i am having trouble writing the code to do that.
i attached the image that i'm trying to get the MTF out of.

Answers (1)

Abhimenyu on 31 Jan 2024
Hi Josh,
I understand that you are trying to calculate the "Modulation Transfer Function (MTF)" using a "Siemens star" target. The "Siemens star" is a radial pattern used to measure the spatial resolution of imaging systems. The "MTF" is a measure of the imaging system's ability to transfer contrast at a particular resolution from the subject to the image.
Please follow the below mentioned steps to compute the "MTF" using a "Seimens star" target:
  • Load image: Read the image into the MATLAB workspace using the "imread" MATLAB function.
  • Convert to grayscale: If the image is in color, convert it to grayscale using the "rgb2gray" MATLAB function.
  • Find the centre and radii: Locate the centre and the radii of the "Seimens star" using the "imfindcircles" MATLAB function. Please adjust the parameters of the function to get the best results.
  • Extract radial information: Extract radial line profiles from the center to the edge of the star at multiple angles. This involves sampling the pixel values along lines that radiate outward from the center of the star. Use the "linspace" MATLAB function to define a set of angles to sample the spokes along the radii of the star target. Use a "for" loop to iterate over the angles and use the "improfile" MATLAB function to extract the pixel values along the radius of the star target. Please specify the length and the center of the profile to get the correct values. Please refer to the example MATLAB code below:
% Number of angles to sample
numAngles = 100;
angles = linspace(0, 2*pi, numAngles);
% Initialize the radial profile matrix
radialProfiles = [];
% Extract radial profiles
for angle = angles
% Define the radial line at this angle
% ...
xCoords = centerX + radii * cos(angle);
yCoords = centerY + radii * sin(angle);
% Sample the pixel values along the radial line
radialProfile = improfile(grayImage, xCoords, yCoords);
% Store the radial profile
radialProfiles = [radialProfiles, radialProfile];
  • Calculate Spatial Frequency: Apply a "Fourier Transform" using the "fft" MATLAB function to each radial profile to get the frequency domain representation. Calculate the spatial frequency for each radius. The spatial frequency increases from the center of the star to the edges. Please refer to the example MATLAB code below:
% Calculate spatial frequencies and MTF
mtfValues = [];
for i = 1:size(radialProfiles, 2)
% Fourier Transform of the radial profile
ftProfile = abs(fft(radialProfiles(:, i)));
% Normalize the Fourier Transform
normalizedFTProfile = ftProfile / max(ftProfile);
% Store the MTF value
mtfValues = [mtfValues, normalizedFTProfile];
% Average MTF values over all angles
averageMTF = mean(mtfValues, 2);
% Calculate spatial frequencies (this will depend on your specific setup)
spatialFrequencies = linspace(0, 1, numel(averageMTF));
  • Plot "MTF": Plot the "MTF" as a function of spatial frequency as given by the example MATLAB code below:
% Plot the MTF curve
plot(spatialFrequencies, averageMTF);
xlabel('Spatial Frequency (cycles/mm)');
title('Modulation Transfer Function');
Using the method given above, the MTF graph for a "Seimens star" target can be computed.
Please refer to the below mentioned MATLAB R2023b documentation links for more information on the "imread" function, "rgb2gray" function, "imfindcircles" function, "linspace" function, "improfile" function and "fft" function respectively:
Please refer to the link mentioned below for gaining more insight into the procedure for using “Seimens Star” target to obtain the “MTF”:
I hope this helps to resolve your query.


Find more on Polar Plots in Help Center and File Exchange





Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!