question archive Lab-HW: Filtering an Image to Find Edges One-dimensional FIR filters, such as running averagers and first-difference filters, can be used to process one-dimensional signals such as speech or music
Subject:MathPrice: Bought3
Lab-HW: Filtering an Image to Find Edges One-dimensional FIR filters, such as running averagers and first-difference filters, can be used to process one-dimensional signals such as speech or music. These same filters can be applied to images if we regard each column (or row) of the image as a one-dimensional signal. For example, the 50th row of an image is the N-point sequence xx [50, n] for 1 < n < N, so we can filter this sequence with a 1-D filter using the conv or firfilt operator, e.g., to filter the mo-th row: yi[mo, n] = x[mo, n] - x[mo, n - 1] (a) Load in the image echart . mat (from the SP-First Toolbox) with the load command. This will create the variable echart whose size is 257 x 256. Use MATLAB's imshow function (or show ing from the SP-First toolbox) to view the image. (b) Then filter one row of the image with a first difference filter: yy1 = firfilt (echart (m, :), firstDiffFilterCoeffs) ; Pick a row where there the are several black-white-black transitions, e.g., choose row number 65, 147, or 221. Display the row of the input image echart and the filtered row yy1 on the screen in the same figure window (with subplot). Use stem because these signals are one-dimensional signals. (c) Compare the two stem plots and give a qualitative description. Note that the polarity (positive/negative) of the impulses will denote whether the transition is from white to black, or black to white. (d) Then explain how to calculate the total width of the character "E" from the impulses in the stem plot of an appropriately chosen filtered row. Note: Use the MATLAB function find to get the locations of the impulses in the filtered row yy1.