国产aaaa级全身裸体精油片_337p人体粉嫩久久久红粉影视_一区中文字幕在线观看_国产亚洲精品一区二区_欧美裸体男粗大1609_午夜亚洲激情电影av_黄色小说入口_日本精品久久久久中文字幕_少妇思春三a级_亚洲视频自拍偷拍

首頁 > 行業(yè)資訊 > 【圖像分割】基于灰狼算法優(yōu)化Renyi熵實現(xiàn)圖像多閾值分割附Matlab代碼

【圖像分割】基于灰狼算法優(yōu)化Renyi熵實現(xiàn)圖像多閾值分割附Matlab代碼

時間:2022-09-22 來源: 瀏覽:

【圖像分割】基于灰狼算法優(yōu)化Renyi熵實現(xiàn)圖像多閾值分割附Matlab代碼

天天Matlab 天天Matlab
天天Matlab

TT_Matlab

博主簡介:擅長智能優(yōu)化算法、神經網絡預測、信號處理、元胞自動機、圖像處理、路徑規(guī)劃、無人機等多種領域的Matlab仿真,完整matlab代碼或者程序定制加qq1575304183。

收錄于合集 #圖像處理matlab源碼 840個

1 內容介紹

在圖像閾值分割方法中,Renyi熵法因其顯著效能而得到大量應用.為了更好地發(fā)揮Renyi熵在圖像分割中的應用,提出把Renyi熵法擴展到圖像多級閾值化問題.然而,由于計算時間復雜度上的高要求,很難把這種有效的技術推廣到復雜圖像多級閾值化問題.為減少本方法的計算時間,應用灰狼優(yōu)化算法實施最佳閾值的搜索.實驗結果表明,本方法能有效地對圖像進行多級分割,并且顯著降低計算時間.

2 部分代碼

% Grey Wolf Optimizer

function [Alpha_score,Alpha_pos,Convergence_curve]=GWO(SearchAgents_no,Max_iter,lb,ub,dim,fhandle,fnonlin)

% initialize alpha, beta, and delta_pos

Alpha_pos=zeros(1,dim);

Alpha_score=inf; %change this to -inf for maximization problems

Beta_pos=zeros(1,dim);

Beta_score=inf; %change this to -inf for maximization problems

Delta_pos=zeros(1,dim);

Delta_score=inf; %change this to -inf for maximization problems

%Initialize the positions of search agents

Positions=initialization(SearchAgents_no,ub,lb);

Convergence_curve=zeros(1,Max_iter);

l=0;% Loop counter

% Main loop

while l<Max_iter

    for i=1:size(Positions,1)  

        

       % Return back the search agents that go beyond the boundaries of the search space

        Flag4ub=Positions(i,:)>ub;

        Flag4lb=Positions(i,:)<lb;

        Positions(i,:)=(Positions(i,:).*(~(Flag4ub+Flag4lb)))+ub.*Flag4ub+lb.*Flag4lb;               

        

        %% Calculate objective function for each search agent

        fitness=Fun(fhandle,fnonlin,Positions(i,:));  

        

        %% Update Alpha, Beta, and Delta

        if fitness<Alpha_score 

            Alpha_score=fitness; % Update alpha

            Alpha_pos=Positions(i,:);

        end

        

        if fitness>Alpha_score && fitness<Beta_score 

            Beta_score=fitness; % Update beta

            Beta_pos=Positions(i,:);

        end

        

        if fitness>Alpha_score && fitness>Beta_score && fitness<Delta_score 

            Delta_score=fitness; % Update delta

            Delta_pos=Positions(i,:);

        end

    end

    

    

    a=2-l*((2)/Max_iter); % a decreases linearly fron 2 to 0

    

    % Update the Position of search agents including omegas

    for i=1:size(Positions,1)

        for j=1:size(Positions,2)     

                       

            r1=rand(); % r1 is a random number in [0,1]

            r2=rand(); % r2 is a random number in [0,1]

            

            A1=2*a*r1-a; % Equation (3.3)

            C1=2*r2; % Equation (3.4)

            

            D_alpha=abs(C1*Alpha_pos(j)-Positions(i,j)); % Equation (3.5)-part 1

            X1=Alpha_pos(j)-A1*D_alpha; % Equation (3.6)-part 1

                       

            r1=rand();

            r2=rand();

            

            A2=2*a*r1-a; % Equation (3.3)

            C2=2*r2; % Equation (3.4)

            

            D_beta=abs(C2*Beta_pos(j)-Positions(i,j)); % Equation (3.5)-part 2

            X2=Beta_pos(j)-A2*D_beta; % Equation (3.6)-part 2       

            

            r1=rand();

            r2=rand(); 

            

            A3=2*a*r1-a; % Equation (3.3)

            C3=2*r2; % Equation (3.4)

            

            D_delta=abs(C3*Delta_pos(j)-Positions(i,j)); % Equation (3.5)-part 3

            X3=Delta_pos(j)-A3*D_delta; % Equation (3.5)-part 3             

            

            Positions(i,j)=(X1+X2+X3)/3;% Equation (3.7)

            

        end

    end

    l=l+1;    

    Convergence_curve(l)=Alpha_score;

end

3 運行結果

4 參考文獻

[1]聶方彥, 張平鳳, 潘梅森,等. 基于Renyi熵與PSO算法的圖像多級閾值分割[J]. 湖南文理學院學報:自然科學版, 2013, 25(3):6.

博主簡介:擅長 智能優(yōu)化算法 、 神經網絡預測 、 信號處理 、 元胞自動機 、 圖像處理 路徑規(guī)劃 、 無人機 雷達通信 、 無線傳感器 等多種領域的Matlab仿真,相關matlab代碼問題可私信交流。

部分理論引用網絡文獻,若有侵權聯(lián)系博主刪除。

版權:如無特殊注明,文章轉載自網絡,侵權請聯(lián)系cnmhg168#163.com刪除!文件均為網友上傳,僅供研究和學習使用,務必24小時內刪除。
相關推薦