【CDBS】凹边界的修改形状特征描述:应用于皮肤病变分类(Matlab代码实现)

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

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

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

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

💥1 概述

📚2 运行结果

🎉3 参考文献

🌈4 Matlab代码实现

💥1 概述

作为计算机视觉的基本研究内容,图像局部特征描述的目的是利用特征向量来稳定地表达被检测图像的局部特征,从而利用这些特征构成的描述子来稳定进行图像的匹配,具有一定的理论研究价值和实际工程应用价值。特别是随着近年来深度学习技术的兴起与快速发展,该领域的研究者们都相继提出了许多不同的研究方法。如今,基于学习的局部特征描述方法在该领域越来越受欢迎。然而,在不同场景和任务要求中,研究者都在致力于如何设计在精确性、鲁棒性和效率方面具有卓越性能的图像局部特征描述方法。本文对经典的手工设计和主流的基于学习两类方法分别进行全面而系统的分析与总结。最后总结了图像局部特征描述的现状,并为未来的工作提供参考。在本文中,我们提出了一种用于检测黑色素瘤皮肤病变的计算机辅助诊断(CAD)系统。本文的目的是开发一种新的形状描述符来分析形状的轮廓不规则性,称为基于凸缺陷的特征(CDBS)。 主要m_file(CDBS_curve.m)首先计算典型黑色素瘤病变的CDBS。然后,将使用CAD方案呈现病变类型(黑色素瘤或非黑色素瘤)。

📚2 运行结果

部分代码:

% compute Convex Deficiency-Based Signature for an examplary melanoma lesion
% exctracting 5 proposed features from CDBS curve
% exctracting 12 shape & textural features
% plotting CDBS curve
% detecting type of the lesion

clc
clear all
close all

% reading original melanoma image & its binary mask
I=imread('./SSM25_orig.jpg');
imBW=imread('./SSM25_contour.png');

% Preprocessing the input RGB image
im = PREPROCESS(I);

% obtaining coordinates of lesion contour
[B,L] = bwboundaries(imBW,'noholes');
bn=B{1,1};

% obtaining convex hull of lesion shape
s1=regionprops(L,'ConvexHull','Area','Perimeter','centroid',...
    'PixelList','Solidity','Extent','BoundingBox');
ch=cat(1,s1.ConvexHull);

% calculating CDBS
di=zeros(length(ch),length(bn));
for j=1:length(bn)
    for k=1:length(ch)
        di(k,j)=sqrt( (bn(j,1)-ch(k,2))^2+(bn(j,2)-ch(k,1))^2 );
    end  
end

CDBS=min(di);

%% Extracting features from CDBS Curve

% Finding Local Extrema
[ymax1,imax1,ymin1,imin1] = extrema(CDBS);

% Variance of CDBS curve
Fp(1,1) = var(CDBS,1);

% 10th order central standardized moment of CDBS curve
Fp(2,1) = normoment(CDBS,10);

% Ratio of Median point of CDBS curve 
% to number of boundary points
Fp(3,1) = median(CDBS)/length(CDBS);

% Ratio of number of zero-incidence points on 
% CDBS curve to number of boundary points
Fp(4,1) = (length(find(CDBS==min(CDBS))))/length(CDBS);

% Ratio of number of zero-incidence points to the   
% number of maximum extrema on CDBS curve
Fp(5,1) = (length(find(CDBS==min(CDBS))))/length(ymax1);

%% Extracting shape & textural features

% Transforming main image to gray scale
imgray=rgb2gray(im);

% Transforming main image to HSV color space
imhsv=rgb2hsv(im);

% lesion area
A=cat(1,s1.Area);

% lesion perimeter
P=cat(1,s1.Perimeter);

% coordinate of lesion center
centroids=cat(1,s1.Centroid);

% bounding box information
Box=cat(1,s1.BoundingBox);

% coordinates of lesion pixels
Pix_list=cat(1,s1.PixelList);

% obtaining lesion Major axis & Minor axis information
s2=diameter(L);
maj_co=s2.MajorAxis;
min_co=s2.MinorAxis;

% Computing Major Axis Length 
max_axis=sqrt((maj_co(1,1)-maj_co(2,1))^2+...
    (maj_co(1,2)-maj_co(2,2))^2);

% Computing Minor Axis Length
min_axis=sqrt((min_co(1,1)-min_co(2,1))^2+...
    (min_co(1,2)-min_co(2,2))^2);

% Computing distance of left corner of bounding box
% from centroid of the lesion
dist_Cbox=((Box(1,1)-centroids(1,1))^2+...
    (Box(1,2)-centroids(1,2))^2);

% Computing sum of entire gray scale values of lesion 
for j=1:length(Pix_list)
    gray1(j,1)=imgray(Pix_list(j,2),Pix_list(j,1));
end

% Computing sum of all lesion region values in HSV color space
for k=1:3
    for j=1:length(Pix_list)
        hsv1(j,k)=imhsv(Pix_list(j,2),Pix_list(j,1),k);
    end
    Shsv(1,k)=sum(hsv1(:,k));
end

% Ratio of lesion area to its bounding box area.
Fl(1,1)=cat(1,s1.Extent);

% Ratio of maximum axis of the lesion to its minimum axis
Fl(2,1)=max_axis/min_axis;

% Ratio of the lesion bounding box length to its bounding box width
Fl(3,1)=Box(1,3)/Box(1,4);

% Ratio of lesion area to its convex hull area
Fl(4,1)=cat(1,s1.Solidity);

% Ratio of the lesion area to the distance of leftcorner
% of bounding box from centroid of the lesion
Fl(5,1)=A/dist_Cbox;

% Ratio of sum of entire gray scale values of
% lesion region to its area 
Fl(6,1)=sum(gray1)/A;

% Ratio of the lesion area to its squared perimeter
Fl(7,1)=A/(P^2);

% Ratio of the lesion perimeter to its bounding box perimater
Fl(8,1)=P/(2*(Box(1,3) + Box(1,4)));

% Ratio of the sum of all lesion region values 
% in HSV color space to the lesion area
Fl(9,1)=Shsv(1,1)/A;
Fl(10,1)=Shsv(1,2)/A;
Fl(11,1)=Shsv(1,3)/A;

% A nonlinear combination of Fl(6,1) & Fl(11,1)
Fl(12,1) = Fl(6,1)^2 + Fl(11,1)^2;

%% figures 

% displaying melanoma lesion with its convex hull
figure(1),
plot(bn(:,2),bn(:,1),'Color','k','LineWidth',2)
hold on
plot(ch(:,1),ch(:,2),'Color','k',...
    'LineWidth',3,'LineStyle','--')
legend('C(t)','H(l)')
hold off
saveas(gcf, './imBW.png')

% plotting CDBS curve of a melanoma lesion
figure(2),plot(CDBS,'Color','b','LineWidth',3)
grid on
xlabel('t','FontSize',10,'FontWeight','bold')
ylabel('RCH(t)','FontSize',10,'FontWeight','bold')
title('CDBS Curve')
saveas(gcf, './CDBScurve.png')

%% Estimating type of lesion

% combining Fp & Fl
F = [Fl; Fp];

% loading data: weight matrices, randomly split trainset, 
% testset and their targets
load('./Preset.mat')

% loading normalizing factors of each fold
load('./mMax.mat')

M = 0;
nM = 0;
% detecting types of the lesion by performing the classification 
% algorithm over 10 separate trials
for kk = 1:10
    
    % loading weight matrices for each trials
    Pre = Preset{kk,1};
    Weight = Pre{1,3};
    
    % 
    minmax1 = mMax{kk,1};
    
    % calculating the output of sample during 5-fold cross-validation
    for gg = 1:5
        
        % min features
        min_f = minmax1{gg,1};
        
        % max features
        max_f = minmax1{gg,2};
        
        % Normalizing Test data
        Testdata = (F'-min_f)./(max_f-min_f);

        % loading wieght matrix of first layer in each trial
        v = Weight{gg,2};
        % loading wieght matrix of second layer in each trial
        w = Weight{gg,1};

        % compute output for testset
        y = Output(Testdata,v,w);
        
        % counting the number of times that test data is detected as 
        % melanoma or non-melanoma in each fold and each trial
        if y(1,1)>y(2,1)
            M = M + 1;
        else 
            nM = nM + 1;
        end

        w=[];v=[];
    end

    Pre = []; minmax1 = [];
end

% detecting the type of the lesion by majority voting
if M > nM
    display('Melanoma Detected')
else 
    display('non-Melanoma Detected')
end

🎉3 参考文献

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

[1]Saeid Amouzad Mahdiraji, Yasser Baleghi, Sayed Mahmoud Sakhaei (2018) CDBS: Modified Shape Signature for Concave Boundaries Description: Application to Skin Lesion Classification 

[2]付苗苗,杜光星.基于局部特征描述的图像匹配方法分析[J].信息记录材料,2022,23(10):135-137.DOI:10.16009/j.cnki.cn13-1295/tq.2022.10.027.

🌈4 Matlab代码实现

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值