[5 points] Given an RGB image, quantize the 3-dimensional RGB space, and map eac
ID: 660925 • Letter: #
Question
[5 points] Given an RGB image, quantize the 3-dimensional RGB space, and map each pixel in the input image to its nearest k-means center. That is, replace the RGB value at each pixel with its nearest cluster?s average RGB value. Use the following form: Function [outputlmg, meanColors] = quantizeRGB(origlmg, k) where origlmg and output Img are MxNx3 matrices of type uint8, k specifies the number of colors to quantize to, and meanColors is a k x 3 array of the k centers. Matlab tip: if the variable origlmg is a 3d matrix containing a color image with numpixels pixels, X = reshape (origlmg, numpixels, 3); will yield a matrix with the RGB features as its rows.Explanation / Answer
The following function might be helpful.
impixel(I)
P = impixel(I,c,r)
P = impixel(X,map)
P = impixel(X,map,c,r)
[c,r,P] = impixel(___)
P = impixel(x,y,I,xi,yi)
[xi,yi,P] = impixel(x,y,I,xi,yi)
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.