k means - Segementing a 3-D matrix with MATLAB -


i have 3-d matrix representing hyper-spectral image: 2 dimensions represent different pixels, , 1 dimension represents different spectral bands.

i need segment image in following way: 1. divide image, pixel-wise, 2 segments. 2. calculate average spectral value each of 2 segments. 3. set pixels in each of 2 segments equal said average.

in end, need image divided 2 segments, pixels in same segment equal segment's spectral average.

i've tried using kmeans, no success far.

does have idea how it?

it if elaborate on kmeans() not working you. suspect trying preserve image dimensions (m x n pixels) in call kmeans.

if collapse across rows/cols, kmeans should able classify each pixel spectral-band vector.

[m,n,sps] size(data); %pixel row, pixel col, spectral band numgroups = 2; [idx,centers] = kmeans(reshape(data,[m*n,sps]),numgroups); 

Comments

Popular posts from this blog

python - How to insert QWidgets in the middle of a Layout? -

python - serve multiple gunicorn django instances under nginx ubuntu -

module - Prestashop displayPaymentReturn hook url -