程序代写代做代考 matlab University of Lincoln School of Computer Science CMP3108M – Image Processing

University of Lincoln School of Computer Science CMP3108M – Image Processing
Week 7&8: Morphological Image Processing Getting Started
The files required for this workshop can be downloaded from Blackboard (workshop7.zip). The files you need for this workshop are
broken-text.tif , noisy-fingerprint.tif, coins.gif
Note: Read each task carefully before starting to solve it.
Task 1: Basic Morphological Operations
Load binary test images (e.g. broken-text.tif , noisy-fingerprint.tif, coins.gif) into MATLAB with the usual commands, e.g.,
>> b = imread(‘noisy-fingerprint.tif’); The IPT function strel constructs structuring elements with a variety of shapes and size. Its basic syntax is:
>> se = strel(shape, parameters);
where shape is a string specifying the desired shape, and parameters is a list of parameters that specify information about the element’s shape, such as its size. For example,
>> se = strel(‘disk’, 2)
returns a disk-shaped structuring element with a radius of 2 pixels.
Using structuring elements of various shapes and sizes, try out the following MATLAB commands for morphological operations on some of the binary test images (please refer to help for further information):
• imdilate–imagedilation • imerode–imageerosion • imopen–imageopening
• imclose– image closing

Task 2: Separation of touching coins
Load binary image (coins.gif), please use morphology operations to separate all the touching objects. You need to define a suitable structuring element for this task.
Task 3: Morphology Opening
Given the input binary image as shown in Fig.1 (a) and SE (b), please use pen and paper to draw the output image using the closing operation.
(a) (b)
Task 4: Counting using Connected Components (week 8)
You can also try out the MATLAB command bwlabel for labelling the connected components of a binary image as follows:
>> [L, num] = bwlabel(f, conn);
where f is an input binary image and conn specifies the desired connectivity (either 4 or 8). Output L is called a label matrix, and num (optional) gives the total number of connected components found. To visualise the labelling results you can use the label2rgb command, e.g.,
>> label2rgb(L, ‘jet’, ‘c’, ‘shuffle’);
The function accepts several parameters that can be customised, including a desired colormap (e.g., ‘jet’), starting colour (e.g., ‘c’ for cyan) and option for randomising the colour palette (‘shuffle’).

1) Using the above commands, try to remove the noise from the test image noisy_fingerprint.tif and then use bwlabel to count the number of connected components in the “cleaned up” image.
2) Using the result from problem 2, count the coins.
Task 5: Hit-or-miss Transform (week 8)
The hit-or-miss transform is the morphological operator for finding local patterns of pixels.
>> g=bwhitmiss(image,B1,B2);
B1, B2 are structure elements. Give the shape image as shown in (a), you can use
B1 and B2 defined as below:
>>B1=strel([0 0 0; 0 1 1; 0 1 0]); >>B2=strel([1 1 1; 1 0 0; 1 0 0]);
to extract the four corners highlighted in the red circles as shown in (b). Please try and understand the code. You can also try to extract different corners using different B1 and B2.
(a) (b)