Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个表示高光谱图像的 3-D 矩阵:2 维表示不同的像素,1 维表示不同的光谱带。
我需要按以下方式分割此图像: 1. 将图像按像素划分为 2 段。2. 计算 2 段中每段的平均光谱值。3. 将 2 段中的每段中的所有像素设置为等于所述平均值。
最后,我需要将图像分成 2 段,同一段中的所有像素都等于该段的光谱平均值。
我试过使用kmeans,但到目前为止没有成功。
有谁知道该怎么做?
如果您详细说明什么kmeans()不适合您,这将有所帮助。我怀疑您正在尝试在调用kmeans.
kmeans()
kmeans
如果跨行/列折叠,kmeans 应该能够通过其光谱带向量对每个像素进行分类。
[m,n,sps] size(data); %pixel row, pixel col, spectral band numGroups = 2; [idx,centers] = kmeans(reshape(data,[m*n,sps]),numGroups);