标签: matlab k-means imread
我的图片大小为128x128。我已经在它上面应用了matlab的imread功能, A = imread(first.jpg); 但这会给我一个三维数组128x128x3,如何将它转换为由3列R,G,B组成的二维矩阵(每种颜色一列)?
答案 0 :(得分:1)
A = imread('first.jpg'); Npixels = size(A,1)*size(A,2); newA = reshape(A,[Npixels,3]);