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’.
其他代写:matlab代写 program代写 project代写 homework代写 java代写 essay作业代写 finance代写 python代写 essay代写 report代写 paper代写 assignment代写 加拿大代写 作业代写 作业加急 北美代写 英国代写 北美作业代写
合作平台:essay代写 论文代写 写手招聘 英国留学生代写