• 大小: 475KB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2021-05-21
  • 语言: Matlab
  • 标签: ffff  

资源简介

最大类间方差(OSTU 自适应阈值提取 图像边缘增强算法 MATLAB代码

资源截图

代码片段和文件信息

function [BVDV]=BVandDV(ImgTh)
% Img=imread(‘LENA.bmp‘);
% Th=117;

% %rgb转灰度
% if isrgb(Img)==1
%     I_gray=rgb2gray(Img);
% else
%     I_gray=Img;
% end
% Img=I_gray;

Itemp=Menlarge(Img33);%扩大周围
[mn]=size(Itemp);
Bsum=0;
Bcount=0;
Dsum=0;
Dcount=0;
if size(Th1)==1
    for i=1:m
        for j=1:n
            if Itemp(ij)>=Th
                Rr(ij)=255;%前景
            else
                Rr(ij)=0;%背景
            end
        end
    end
    for i=2:m-1
        for j=2:n-1
            if Rr(ij)==0%背景
                Bsum=Bsum+((Itemp(ij)-Itemp(i-1j))^2+(Itemp(ij)-Itemp(i+1j))^2+(Itemp(ij)-Itemp(ij-1))^2+(Itemp(ij)-Itemp(ij+1))^2)/4;
                Bcount=Bcount+1;
            else
                Dsum=Dsum+((Itemp(ij)-Itemp(i-1j))^2+(Itemp(ij)-Itemp(i+1j))^2+(Itemp(ij)-Itemp(ij-1))^2+(Itemp(ij)-Itemp(ij+1))^2)/4;
                Dcount=Dcount+1;
            end
        end
    end
end
if size(Th1)==m-2
    for i=2:m-1
        for j=2:n-1
            if Th(i-1j-1)==0%背景
                Bsum=Bsum+((Itemp(ij)-Itemp(i-1j))^2+(Itemp(ij)-Itemp(i+1j))^2+(Itemp(ij)-Itemp(ij-1))^2+(Itemp(ij)-Itemp(ij+1))^2)/4;
                Bcount=Bcount+1;
            else
                Dsum=Dsum+((Itemp(ij)-Itemp(i-1j))^2+(Itemp(ij)-Itemp(i+1j))^2+(Itemp(ij)-Itemp(ij-1))^2+(Itemp(ij)-Itemp(ij+1))^2)/4;
                Dcount=Dcount+1;
            end
        end
    end
end
BV=Bsum/Bcount;
DV=Dsum/Dcount;

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件       1525  2013-09-12 20:37  Bian_Yuan_Zeng_Qiang\BVandDV.m

     文件     786486  2000-08-28 12:02  Bian_Yuan_Zeng_Qiang\LENA.BMP

     文件       1595  2013-09-12 20:36  Bian_Yuan_Zeng_Qiang\LOG_enhancement.m

     文件        628  2013-09-12 19:21  Bian_Yuan_Zeng_Qiang\Menlarge.m

     文件        808  2013-09-12 20:06  Bian_Yuan_Zeng_Qiang\Otsu.m

     目录          0  2013-09-12 20:53  Bian_Yuan_Zeng_Qiang

----------- ---------  ---------- -----  ----

               791042                    6


评论

共有 条评论

相关资源