【目标检测】基于稀疏表示的高光谱图像(Matlab代码实现)

💥💥💞💞欢迎来到本博客❤️❤️💥💥

🏆博主优势:🌞🌞🌞博客内容尽量做到思维缜密,逻辑清晰,为了方便读者。

⛳️座右铭:行百里者,半于九十。

📋📋📋本文目录如下:🎁🎁🎁

💥1 概述

📚2 运行结果

🎉3 参考文献

🌈4 Matlab代码实现

💥1 概述

基于稀疏表示的高光谱图像目标检测,是模式识别的有效方法。目标检测旨在通过使用已知的目标像素或异常属性将特定目标像素与各种背景分开。该方法依赖于稀疏表示诱导的未知样本的二元假设模型。样本可以稀疏地由来自背景和目标字典的训练样本表示。模型中的稀疏向量可以通过贪婪算法OMP恢复。目标检测问题可以看作是两个假设(背景)和(目标)的竞争关系。T和B都是矩阵,它们的列向量分为目标子空间和背景子空间。 并分别形成系数的系数向量。N 表示高斯随机噪声,[T,B] 表示 T 和 B 的级联矩阵。假设,当D大于某个阈值η时,则X为目标。这意味着我们需要找到一个投影矩阵p。通过知识的稀疏表示,已知信号重建的残差可以表示为:经过比较,我们可以发现:假设,当D大于某个阈值η时,则X为目标。然后根据ROC曲线比较不同的阈值对应,得出最终结果。

📚2 运行结果

 部分代码:

    Dict_build
    K=3;
    Collect=zeros(P_h*P_w,1);
    index=1;
    for i=1:S_h
       for j=1:S_w
            x=S(i,j,:);
           x=x(:);
          theta_b=OMP(x,Dict_b,K);
          gamma=OMP(x,Dict_t,K);
          n0=x'*(x-Dict_b*theta_b);
          n1=x'*(x-Dict_t*gamma);
          D=n0*(1/n1);
          Collect(index)=D;   %classfication result response
          index=index+1; 
      end;
    end;
    start_=0.2;step=0.2;end_=10;   % cycle Ranges
    num=(end_-start_)/step+1;
    coord=zeros(num,2);
    coord_index=1;
    MIN_DISTENCE=1000000;    %Record the optimal threshold
for threshold=start_:step:end_
    P_compare=zeros(P_h,P_w);
    for i=1:S_h
        for j=1:S_w
            if Collect(P_h*(i-1)+j)>threshold
                 P_compare(i,j)=1;
            end;
        end;
    end;
    sum_TP=0;    %True positive
    sum_FP=0;    %False positive
    sum_FN=0;    %False negative
    sum_TN=0;    %True negative
    for i=1:P_h
     for j=1:P_w
            if P_compare(i,j)==1&&PlaneGT(i,j)==1
             sum_TP=sum_TP+1;
            elseif P_compare(i,j)==0&&PlaneGT(i,j)==1
             sum_FN=sum_FN+1;
            elseif P_compare(i,j)==0&&PlaneGT(i,j)==0
             sum_TN=sum_TN+1;
            elseif P_compare(i,j)==1&&PlaneGT(i,j)==0
             sum_FP=sum_FP+1;
           end;
     end;
    end;
    FPR=sum_FP/(sum_FP+sum_TN);    %False positive rate
    TPR=sum_TP/(sum_TP+sum_FN);    %True positive rate
    distence=(FPR)^2+(1-TPR)^2;
    if distence<MIN_DISTENCE
        MIN_DISTENCE=distence;
        BEST_THRESHOLD=threshold;
    end;
    coord(coord_index,1)=FPR;
    coord(coord_index,2)=TPR;
    coord_index=coord_index+1;
end;
%ROC curve
X=coord(:,1);
Y=coord(:,2);
figure;
plot(X,Y),xlabel('FPR'),ylabel('TPR');%Plot ROC curve

  P_compare=zeros(S_h,S_w);
    for i=1:S_h
        for j=1:S_w
            if Collect(P_h*(i-1)+j)>BEST_THRESHOLD
                 P_compare(i,j)=1;
            end;
        end;
    end;
    
%% Plot
figure
subplot(1,2,1);
imshow(PlaneGT),title('Standard image');
subplot(1,2,2);
imshow(P_compare),title('Test results');

🎉3 参考文献

部分理论来源于网络,如有侵权请联系删除。

[1]Chen Y, Nasrabadi N M, Tran T D. Hyperspectral image classification using dictionary-based sparse representation[J]. IEEE Transactions on Geoscience and Remote Sensing, 2011, 49(10): 3973-3985.

[2]Chen Y, Nasrabadi N M, Tran T D. Sparse representation for target detection in hyperspectral imagery[J]. IEEE Journal of Selected Topics in Signal Processing, 2011, 5(3): 629-640.

🌈4 Matlab代码实现

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值