CSE585/EE555: Digital Image Processing II

Spring 2021

Project #1 — Mathematical Morphology: Hit-or-Miss Transform


assigned: 19 January 2021

due: Friday, 5 February 2021 — files uploaded to CANVAS

reading assignment: Sections 6.1-6.7 of P&V (PitasCh6.pdf) and the Maragos and Schafer paper

                                  (Maragos-Schafer.pdf) — these are under the “Readings” folder on CANVAS.


1. Optional MATLAB Introduction — no required work here. I assume you are already acquainted with processing images in MATLAB. To refresh your memory, you might want to study the following items (all items below appear under “Project Material” on CANVAS):

(a) Read ‘MATLABprimer.pdf,’ ‘G-W-Matlab-Ch2.pdf,’ and ‘MatLabIntro.pdf.’

(b) Experiment with my three sample MATLAB files: main.m, mean3x3.m, and zero.m. Note the way we process 2D image arrays and consider border effects. As a rule, you will zero out the outer portions of an image that can’t be fully processed.

In general, you are NOT allowed to use built-in MATLAB functions for mathematical morphology and other operations directly related to the main project goals, unless I allow it. Thus, you must write your own erosion, dilation, and set-theory operations below.


2. Hit-or-Miss Transform — Consider the image “RandomDisks-P10.jpg” (see “Project Material”). This binary-valued image considers WHITE to be background and BLACK to be foreground (to save on ink if you print things!). It contains five sets of differently-sized solid black disks randomly scattered in the image. Each set of disks is characterized by a specific radius. The image is also corrupted by a 10% level of salt-and-pepper noise. This noise causes the disks to be corrupted by small cavities or very slightly corrupted outer borders. Note that the image is “almost” binary — you will need to threshold it appropriately to convert it into a true binary-valued image for the task below.

Your task is to design one appropriate hit-or-miss transform that detects the smallest and largest disks in the image (and, hence, rejects the disks characterized by the three middle-sized radii). The hit-or-miss transform is given by

as discussed on pages L4-8 — L4-9 of the class notes and P&V eq. (6.2.43), where X is the input image and A and B are appropriately selected structuring elements. Before applying your transform, however, you must first filter the noise with a small close/open filter to fill holes in regions. Note: you can use any means necessary to pick the structuring element sizes (e.g., interactively inspecting the input image with imshow). Thus, the overall series of operations you need for this task are as follows:

(a) Threshold the input image

(b) Filter the image

(c) Apply the hit-or-miss transform


3. Write a detailed report describing your results and implementations.

You must describe your Matlab implementation — as required in all project reports — in the Methods section.

Give a well-commented listing of your MATLAB code, abiding by the code specifications of the class project protocol.

Some points you must discuss and do for your report:

(a) Specify the threshold you use and why.

(b) Discuss exactly how you reduced the salt-and-pepper noise; i.e., what specific filtering did you do.(c) Discuss how you selected structuring elements, A and B, for the hit-or-miss transform.

(d) Suppose you do not apply the small close/open as suggested. Will your hit-or-miss transform work?

     Demonstrate this in your project write-up and discuss your results.

(e) Show pictures for all steps in your processing. The final result should be an image showing just the detected disks.

(f) Provide sufficiently big images in the report, but no more than 4 per page! Have complete figure captions.

In addition, in the Results, you must discuss your results. You will lose much credit if you just present pictures and give no observations.