Main Content

식생 스펙트럼과 비식생 스펙트럼 식별하기

이 예제에서는 다음을 수행하는 방법을 보여줍니다.

  • 2차원 스펙트럼 데이터를 초분광 함수의 초입방으로 사용합니다.

  • ndvi 함수를 사용하여 식생 스펙트럼과 비식생 스펙트럼을 분리합니다.

이 예제를 실행하려면 Image Processing Toolbox™ Hyperspectral Imaging Library가 필요합니다. 애드온 탐색기에서 Image Processing Toolbox Hyperspectral Imaging Library를 설치할 수 있습니다. 애드온 설치에 대한 자세한 내용은 애드온을 받고 관리하기 항목을 참조하십시오. Image Processing Toolbox Hyperspectral Imaging Library를 사용하려면 데스크탑 MATLAB®이 필요합니다. MATLAB® Online™과 MATLAB® Mobile™은 이 라이브러리를 지원하지 않습니다.

2차원 스펙트럼 데이터 불러오기

Indian Pines 데이터 세트의 엔드멤버 20개가 포함된 2차원 스펙트럼 데이터를 작업 공간으로 불러옵니다.

load("indian_pines_endmembers_20.mat")

Indian Pines 데이터 세트의 각 대역에 대한 파장 값을 작업 공간으로 불러옵니다.

load("indian_pines_wavelength.mat")

초분광 함수에 사용할 테스트 데이터 준비하기

reshape 함수를 사용하여 2차원 스펙트럼 데이터를 3차원 볼륨 데이터로 형태 변경합니다.

[numSpectra,spectralDim] = size(endmembers);
dataCube = reshape(endmembers,[numSpectra 1 spectralDim]);

3차원 볼륨 데이터 dataCube와 파장 정보 wavelengthhypercube 함수에 지정하여 한원소 차원을 가진 3차원 hypercube 객체를 생성합니다.

hCube = hypercube(dataCube,wavelength);

NDVI를 계산하여 식생 스펙트럼과 비식생 스펙트럼 분리하기

초입방 객체의 각 스펙트럼에 대한 NDVI 값을 계산합니다.

ndviVal = ndvi(hCube);

식생 스펙트럼은 일반적으로 NDVI 값이 0보다 크고 비식생 스펙트럼은 일반적으로 NDVI 값이 0보다 작습니다. 임계값을 적용하여 식생 스펙트럼과 비식생 스펙트럼을 분리합니다.

index = ndviVal > 0;

식생 엔드멤버와 비식생 엔드멤버를 플로팅합니다.

subplot(2,1,1)
plot(endmembers(index,:)')
title("Vegetation endmembers")
xlabel("Bands")
ylabel("Reflectance Values")
axis tight
subplot(2,1,2)
plot(endmembers(~index,:)')
title("Non-Vegetation endmembers")
xlabel("Bands")
ylabel("Reflectance Values")
axis tight

Figure contains 2 axes objects. Axes object 1 with title Vegetation endmembers, xlabel Bands, ylabel Reflectance Values contains 17 objects of type line. Axes object 2 with title Non-Vegetation endmembers, xlabel Bands, ylabel Reflectance Values contains 3 objects of type line.

참고 항목

| |

관련 항목