AMAT 592 Assignment 1

AMAT 592代写 This assignment needs to be done by MATLAB. Submit on Blackboard. If necessary, compress all code fifiles into a .zip fifile.

This assignment needs to be done by MATLAB. Submit on Blackboard. If necessary, compress all code fifiles into a .zip fifile.

 

In this assignment  AMAT 592代写

You will use K-means clustering to compress RGB color image. Read the MATLAB built-in image peppers.png by the command

I = imread(‘peppers.png’),

which returns a 3-D matrix I of size 384 × 512 × 3. The image has 384 × 512 pixels with each pixel having 3 values for the R(ed)G(reen)B(lue) channels respectively. Each pixel is viewed as a 3-D data point.

 

 

Note that the data type of I is uint8.  AMAT 592代写

Make sure to convert the data type to flfloat by double(I) before clustering. We cluster all the 384×512 data points using K-means and obtain k centroids µ1, . . . , µk. Then the original image can be compressed by replacing each pixel with the centroid of its cluster, so that compressed image only contains k  difffferent colors. The built-in function kmeans implements K-means++ by default. You are recommended to search ‘kmeans’ in the Search Documentation window to have an understanding of its usage. Set the argument MaxIter = 500 when calling kmeans.  AMAT 592代写

You need to visualize 3 compressed images for k = 5, 20, 100 as well as the original one. Make sure to convert the data type back to uint8 before visualization. Display them as a 2 × 2 tabular in the same fifigure using subplot function, and title each subfifigure with, e.g. ‘k = 5’ or ‘Original’.

 

AMAT 592代写

 

联系客服提交作业获取报价与时间?

最快2~12小时即可完成,用技术和耐心帮助客户高效高质量完成作业.