# matlab代写 | CS代写 | 算法代写-MSBD5010 Assignment 2

matlab代写 | CS代写 | 算法代写 : 这是一个基于已有的matlab代码实现相关问题的代写任务

### Overview

This assignment consists of three questions: Connected component, boundary extraction and Expectation-Maximization method. All the works should be submitted via the Canvas system.

You need to complete the missing implementations in the programming section and save the output figures for each question. Please zip all the M-files & output figures and submit it via the Canvas system.

### Programming assignment specifics (100%)

Question 1 Connected component You need to complete the implementation of the routine in connected_component.m that can be used to search for all connected components with connectivity equals to 8 (A 3×3 Structuring element with all 1) on the input image. You are not allow to use the bwlabel()/bwlabeln()/bwconncomp() Matlab built-in function for this question. a) Search for all connected components with connectivity equal to 8 and output the result to the command window in following format: (25%) There are total {number of regions} region(s) : Region 1, no. of pixels = {number of pixels} Region 2, no. of pixels = {number of pixels} …

``````b) Find the largest connected component (in terms of number of pixels) on the input
image. (10%)
``````

#### 2/ 2

Question 2 Boundary extraction You need to complete the implementation of the routine in boundary_extraction.m that can be used to extract the boundary of a binary image with the morphological operations. You are not allowed to use the Matlab built-in function such as % imfilter, imerode or any third-party function in this question. a) Implement "erosion" and find the eroded image from the input image (15%) b) Extract the boundary of the binary image using the result from part (a) (5%)

Question 3 Expectation-Maximization (EM) method You need to complete the implementation of the routine in segment_image.m that can be used to segment gray-level images (consisting of three intensity classes) with global thresholding in the segment_image.m file. The routine estimates the hidden probability density function (PDF) of the intensity values parametrically with the Expectation-maximization method, under the assumption that the PDF can be modeled by a mixture of three Gaussian distributions. Once the parameters of the statistical mixture model are estimated, two minimum error thresholds can be calculated and used to segment a sunset image into three classes: first, second, and third intensity classes.

In this assignment, a code skeleton is given and you need to complete the implementation of the following tasks:

``````a) Estimate the expected posterior probabilities (^1 (|)); (15%)
b) Estimate the parameters of the statistical mixture model; (15%)
c) Calculate the two minimum error thresholds, i.e. the two intersections among
the three Gaussian distributions. (15%)
``````

Note: The stopping routine of this iterative process has been implemented in the skeleton code; you dont need to take care of this part. Please read the comments in the skeleton code carefully and follow the procedures mentioned in the comments.