Physical Optics Lab #5 April 2015 Scanner MTF Evaluation using edge gradient analysis In this lab, you will be using a standard method from the ISO to evaluate the Modulation Transfer Function (MTF) of a scanner. The method is based on edge-gradient analysis, applied to a slanted (rotated) edge feature in a test chart. The calculations will use Matlab scripts, so you do not need extensive experience with Matlab. Background: Edge-gradient analysis is a well-established method for measuring the one-dimensional MTF of an imaging system. For the purposes of this lab, we will define the MTF as the modulus of the Fourier transform of the optical point-spread function (impulse response). The point-spread function is the optical image formed from a point source. For a one-dimensional MTF, we use the line-spread function, where this is the image of a line source. Figure 1 shows the basic steps of edge-gradient analysis. We first acquire a test image of a high-quality edge feature, i.e., a sharp, straight edge from a reference test chart. From this edge, we compute the edge profile, a one-dimensional trace of the system output across the edge in a direction perpendicular to the edge. This edge profile is a function (which becomes a vector after sampling) of distance across the image or scene. The line profile is then computed as the derivative of the edge profile. We then compute the discrete Fourier transform of this vector using the FFT algorithm, which produces a complex-valued output vector. The modulus of this complex-valued vector is the output edge modulation function. Acquire edge Compute profile Discrete Fourier transform Figure 1: Basic steps of Edge Gradient Analysis The test object (with the edge) is characterized the same way by using a reference scanner so that its frequency content is known. The response of the test scanner may be compared to the frequency content of the test object to evaluate the system MTF as the ratio of output modulation to the input modulation. If the test target edge can be considered ideal, at least over the spatial frequency range of interest, then its modulation is flat, i.e., it is composed of all frequencies in equal amounts. The output modulation function of the image of this edge, when appropriately scaled, is the measured MTF. Slanted-Edge Evaluation The edge-gradient method just mentioned was adapted for use to evaluate the imaging performance of digital cameras and scanners. The particular method is based on a slanted, rotated, or tilted edge. Reference 1 describes the various steps in the algorithm. Figure 2 of this reference has ten steps listed, which we will not go into here. Briefly, the method is used to measure measuring the edge modulation function or MTF for a digital image capture system. Using the slanted edge has two advantages;; 1. The algorithm finds the edge, and so is not dependent on precise orientation of the test target 2. The super sampling of the edge profile allows measurement of a pre-sampling MTF. This facilitates the measurement of potential aliasing due to the image sampling.
The principle of the ISO standard [2] is shown in Figure 2. Figure 2: ISO 12233 slant-edge MTF measurement: (a) knife-edge target, (b) projection of edge showing how the edge is rendered onto different pixels and averaged to form the 1-D edge profile (from Modified slanted-edge method and multidirectional modulation transfer function estimation by K.Masaoka, et al., Optics Express, 22(5), pp. 6040-6046 (2014) Note that in the ISO standard and technical literature, the computed measure is referred to as the Spatial Frequency Response (SFR) rather than MTF. This is in part to differentiate the practical edge-based measurement (edge-sfr) from the imaging parameter for an optical imaging system (MTF). You could say that the slanted-edge SFR provides an estimate of the edge modulus or MTF parameter. References: 1. P. D. Burns, Slanted-Edge MTF for Digital Camera and Scanner Analysis, Proc. PICS Conf., IS&T, 135-138, 2000 2. ISO 12233:2000, Photography - electronic still picture cameras resolution measurements, ISO (2000). 3. K.Masaoka, T. Yamashita, Y. Nishida, and M. Sugawara, Modified slanted-edge method and multidirectional modulation transfer function estimation, Optics Express, 22(5), pp. 6040-6046 (2014) Matlab Software: 1. Download the function sfrmat3 and supporting functions from, http://losburns.com/imaging/software/sfredge/sfrmat3_post/index.html 2. Unzip sfr3.zip file and save the folder sfrmat3_post within the Matlab folder on your computer. 3. Add this folder to the Matlab path using pathtool 4. Type >> which sfrmat3 You should see the full path to sfrmat3.m 5. You can type >> help sfrmat3 for full details, but the function sfr_lab will walk you through using the function. 2
Scanner SFR Measurement 1. Using the test target provided, scan the test target using the scanner which will be evaluating. If possible save the image file in TIF format. For example, Scan the target repeatedly without moving it, at several different sampling resolution settings. I used 300, 400, 600, 800 pixels/inch. 2. Open the function sfr_lab.m This script can be used to select image files and compute SFR values for each. Select a consistent edge region for all files, e.g., a horizontal edge. You will see that I plot a computed luminance SFR based on the red, green and blue records. Here is an example for my Epson V600 Scanner for the horizontal edge, so this is the vertical SFR. (Steps 1, 2 in the script). You can repeat this for a vertical edge. 1 0.9 0.8 0.7 Scanner SFR for several sampling settings 300 400 600 800 0.6 0.5 0.4 0.3 0.2 0.1 0 0 1 2 3 4 5 6 7 8 9 10 Frequency, cy/mm Did you expect your result? Do they show optical limitations? 3
3. In part 3 select a single image file and compute the SFR for the red, green and blue color records. For example, 4. Things to consider: What did you learn about the scanner under test? Were horizontal and vertical results similar? When acquiring the images did you investigate any other driver software settings? 4
Listing of sfr_lab.m % sfr_lab % Peter Burns, 14 April 2015 % 1. Select four image files, captured at several resolution settings % (pixels/inch) [f1,p1] = uigetfile('*.*','select 4 image file','multiselect', 'on'); nd = length(f1); if ischar(f1) nd =1; temp = f1; clear f1; f1{1}=temp; end % Allocate for pixels/inch setting for each file dx = zeros(1,nd); sym = [{'r'} {'g'} {'b'} {'k'} {'--r'} {'--g'} {'--b'} {':k'}]; info = imfinfo([p1,f1{2}]) % 2. Loop for region selection, SFR computing and platting for ii = 1:nd % pull image resolution from header info = imfinfo([p1,f1{ii}]); dx(ii) = info.xresolution; % read image array [~, dat] = imageread([p1,f1{ii}]); d1 = getroi(dat,'select an edge'); % Compute SFR [status, dat1] = sfrmat3(1, dx(ii), [.3.6.1], d1); figure(1) plot(dat1(:,1), dat1(:,5),sym{ii}), hold on %pause end hold off xlabel('frequency, cy/mm') ylabel('sfr') legend(num2str(dx')) title('scanner SFR for several sampling settings') % edit to change plotted x,y axis limits axis([0 15 0 1]) % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % 3. Compare SFR results for each color record for a single file [f2,p2] = uigetfile('*.*','select 4 image file','multiselect', 'off'); [~, dat2] = imageread([p2,f2]); [d2,c1] = getroi(dat2,'select an edge'); 5
% We will plot results versus cycles/pixel, so dx = 1 pixel dx = 1; % Compute SFR [status, dat2, e1, fitme, esf, nbin, del2] = sfrmat3(1, 1, [.3.6.1], d2); figure(2) plot(dat2(:,1), dat2(:,2),'r'), hold on plot(dat2(:,1), dat2(:,3),'g') plot(dat2(:,1), dat2(:,4),'b') hold off axis([0 0.5 0 1]) xlabel('frequency, cy/pixel') ylabel('sfr') legend('r', 'g', 'b') 6