资源简介
在MATLAB中实现高光谱异常检测KRX算法,主要是参靠KRX英文原文《Kernel RX-Algorithm: A Nonlinear Anomaly Detector for Hyperspectral Imagery》实现。
代码片段和文件信息
function result=KRX(imagewinlenthtargetShape)
%image 输入3维高光谱图像
%winlenth 局部窗口大小
%targetShape 目标形状
%result 检测结果
switch targetShape%目标形状
case 0
target_spatial=...
[0 0 1 0 0;
0 0 1 0 0;
1 1 1 1 1;
0 0 1 0 0;
0 0 1 0 0];
case 1
target_spatial=...
[1 1 1;
1 1 1;
1 1 1];
case 2
target_spatial=...
[1 0 0 0 1;
0 1 0 1 0;
0 0 1 0 0;
0 1 0 1 0;
1 0 0 0 1];
case 3
target_spatial=...
[1 0 0 0 0 0 1;
0 1 0 0 0 1 0;
0 0 1 0 1 0 0;
0 0 0 1 0 0 0;
0 0 1 0 1 0 0;
0 1 0 0 0 1 0;
1 0 0 0 0 0 1];
otherwise
disp(‘Unknown shape.‘)
end
sizeTarget=size(target_spatial);
% 若为二维图象,将其看作一幅第三维为1的三维图象
SizeA=size(image);
if length(SizeA)==2
SizeA(3) = 1;
end
% 若为二维图象,将其看作一幅第三维为1的三维图象
SizeA=size(image);
if length(SizeA)==2
SizeA(3) = 1;
end
%将image扩充为imageExpand
imageExpand((winlenth+1)/2:(winlenth-1)/2+SizeA(1) (winlenth+1)/2:(winlenth-1)/2+SizeA(2):)=image; %中
imageExpand((winlenth-1)/2:-1:1(winlenth+1)/2:(winlenth-1)/2+SizeA(2):)=image(1:(winlenth-1)/2::); %上
imageExpand(winlenth-1+SizeA(1):-1:(winlenth+1)/2+SizeA(1)(winlenth+1)/2:(winlenth-1)/2+SizeA(2):)...%下
=image(SizeA(1)-(winlenth-3)/2:SizeA(1)::); %
imageExpand((winlenth+1)/2:(winlenth-1)/2+SizeA(1)(winlenth-1)/2:-1:1:)=image(:1:(winlenth-1)/2:); %左
imageExpand((winlenth+1)/2:(winlenth-1)/2+SizeA(1)winlenth-1+SizeA(2):-1:(winlenth+1)/2+SizeA(2):)...%右
=image(:SizeA(2)-(winlenth-3)/2:SizeA(2):); %
imageExpand((winlenth-1)/2:-1:1(winlenth-1)/2:-1:1:)=image(1:(winlenth-1)/21:(winlenth-1)/2:); %左上
imageExpand(winlenth-1+SizeA(1):-1:(winlenth+1)/2+SizeA(1)winlenth-1+SizeA(2):-1:(winlenth+1)/2+... %右下
SizeA(2):)=image(SizeA(1)-(winlenth-3)/2:SizeA(1)SizeA(2)-(winlenth-3)/2:SizeA(2):); %
imageExpand(winlenth-1+SizeA(1):-1:(winlenth+1)/2+SizeA(1)(winlenth-1)/2:-1:1:)... %左下
=image(SizeA(1)-(winlenth-3)/2:SizeA(1)1:(winlenth-1)/2:); %
imageExpand((winlenth-1)/2:-1:1winlenth-1+SizeA(2):-1:(winlenth+1)/2+SizeA(2):)... %右上
=image(1:(winlenth-1)/2SizeA(2)-(winlenth-3)/2:SizeA(2):); %
clear image;
spatial_pattern=zeros(winlenthwinlenth);%winlenth应该是窗口大小
targetSize=size(target_spatial);
result=zeros(SizeA(1)SizeA(2));
for i=1:targetSize(1)
for j=1:targetSize(2)
spatial_pattern((winlenth-targetSize(1))/2+i(winlenth-targetSize(1))/2+j)=1;
end
end
s=zeros(1winlenth*winlenth);
k=1;
for i=1:winlenth
for j=1:winlenth
% s((i-1)*winlenth+j)=spatial_pattern(
相关资源
- 高光谱图像pca分析特征提取
- 高光谱图像在matlab里的读入与显示
- Indian高光谱遥感数据集
- 高光谱遥感图像分类matlab.rar
- GDA产生式算法Matlab代码带高光谱文件
- 支持向量机 SVM 和 核函数的 MATLAB 程序
- 支持向量机SVM和核函数的matlab程序代
- 高光谱解混数据集Japser Ridge
- 高光谱解混数据集Samson
- matlab对Paviau高光谱数据集分类
- sandiego airport 高光谱数据
- 通过svm cnn knn对高光谱数据集PaviaU进行
- 高光谱解混数据集Urban
- 高光谱遥感数据集Salinas
- 高光谱工具箱Matlab版
- Indian_pinesMATLAB格式的高光谱数据集和
- 高光谱图像和matlab读取程序
- 高光谱图像分类--SVM
- matlab cnn高光谱图像分类
- matlab处理高光谱数据算法源码
- matlab开发-高光谱解混和去噪
- 高光谱遥感图像FuzzyMeansCluster算法-m
- 利用PCA降维方法处理高光谱图像matl
- 高光谱异常探测算法RXD的matlab实现
- 支持向量机SVM和核函数的matlab程序集
- 高光谱端元提取算法PPI,matlab编写。
- FCLS matlab源码 丰度估计
- hyperspectral toolbox for matlab - 高光谱图
- 光谱数据重采样
- KPCA MATLAB程序,提供4种核函数,根据
评论
共有 条评论