中文字幕av专区_日韩电影在线播放_精品国产精品久久一区免费式_av在线免费观看网站

溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

matlab怎么實現圖像的自適應多閾值快速分割

發布時間:2022-10-10 17:28:45 來源:億速云 閱讀:313 作者:iii 欄目:web開發

今天小編給大家分享一下matlab怎么實現圖像的自適應多閾值快速分割的相關知識點,內容詳細,邏輯清晰,相信大部分人都還太了解這方面的知識,所以分享這篇文章給大家參考一下,希望大家閱讀完這篇文章后有所收獲,下面我們一起來了解一下吧。

1 內容介紹

為快速準確地將圖像中目標和背景分離開來,將新型群體智能模型中的花朵授粉算法、最大類間閾值相結合,提出了一種圖像分割新方法.該方法將圖像閾值看成花朵授粉算法群算法中的花粉,利用信息熵和最大熵原理設計花朵授粉算法的適應度函數,逐代逼近最佳閾值.并利用Matlab實現了圖像分割算法,對分割的結果進行分析.實驗結果表明,該方法在閾值分割圖像時,花朵授粉算法能夠快速準確地將圖像目標分離出來,分離出來的目標更加適合后序的分析和處理.

2 部分代碼

% --------------------------------------------------------------------%

% Flower pollenation algorithm (FPA), or flower algorithm             %

% Programmed by Xin-She Yang @ May 2012                               %

% --------------------------------------------------------------------%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% Notes: This demo program contains the very basic components of      %

% the flower pollination algorithm (FPA), or flower algorithm (FA),   %

% for single objective optimization.    It usually works well for     %

% unconstrained functions only. For functions/problems with           %

% limits/bounds and constraints, constraint-handling techniques       %

% should be implemented to deal with constrained problems properly.   %

%                                                                     %

% Citation details:                                                   %

%1)Xin-She Yang, Flower pollination algorithm for global optimization,%

% Unconventional Computation and Natural Computation,                 %

% Lecture Notes in Computer Science, Vol. 7445, pp. 240-249 (2012).   %

%2)X. S. Yang, M. Karamanoglu, X. S. He, Multi-objective flower       %

% algorithm for optimization, Procedia in Computer Science,           %

% vol. 18, pp. 861-868 (2013).                                        %

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

clc

clear all

close all

n=30;           % Population size, typically 10 to 25

p=0.8;           % probabibility switch

% Iteration parameters

N_iter=3000;            % Total number of iterations

fitnessMSE = ones(1,N_iter);

% % Dimension of the search variables Example 1

d=2;

Lb = -1*ones(1,d);

Ub = 1*ones(1,d);

% % Dimension of the search variables Example 2

% d=3;

% Lb = [-2 -1 -1];

% Ub = [2 1 1];

%

% % Dimension of the search variables Example 3

% d=3;

% Lb = [-1 -1 -1];

% Ub = [1 1 1];

%

%

% % % Dimension of the search variables Example 4

% d=9;

% Lb = -1.5*ones(1,d);

% Ub = 1.5*ones(1,d);

% Initialize the population/solutions

for i=1:n,

    Sol(i,:)=Lb+(Ub-Lb).*rand(1,d);

    % To simulate the filters use fitnessX() functions in the next line

    Fitness(i)=fitness(Sol(i,:));

end

% Find the current best

[fmin,I]=min(Fitness);

best=Sol(I,:);

S=Sol;

% Start the iterations -- Flower Algorithm

for t=1:N_iter,

    % Loop over all bats/solutions

    for i=1:n,

        % Pollens are carried by insects and thus can move in

        % large scale, large distance.

        % This L should replace by Levy flights

        % Formula: x_i^{t+1}=x_i^t+ L (x_i^t-gbest)

        if rand>p,

            %% L=rand;

            L=Levy(d);

            dS=L.*(Sol(i,:)-best);

            S(i,:)=Sol(i,:)+dS;

            % Check if the simple limits/bounds are OK

            S(i,:)=simplebounds(S(i,:),Lb,Ub);

            % If not, then local pollenation of neighbor flowers

        else

            epsilon=rand;

            % Find random flowers in the neighbourhood

            JK=randperm(n);

            % As they are random, the first two entries also random

            % If the flower are the same or similar species, then

            % they can be pollenated, otherwise, no action.

            % Formula: x_i^{t+1}+epsilon*(x_j^t-x_k^t)

            S(i,:)=S(i,:)+epsilon*(Sol(JK(1),:)-Sol(JK(2),:));

            % Check if the simple limits/bounds are OK

            S(i,:)=simplebounds(S(i,:),Lb,Ub);

        end

        % Evaluate new solutions

        % To simulate the filters use fitnessX() functions in the next

        % line

        Fnew=fitness(S(i,:));

        % If fitness improves (better solutions found), update then

        if (Fnew<=Fitness(i)),

            Sol(i,:)=S(i,:);

            Fitness(i)=Fnew;

        end

        % Update the current global best

        if Fnew<=fmin,

            best=S(i,:)   ;

            fmin=Fnew   ;

        end

    end

    % Display results every 100 iterations

    if round(t/100)==t/100,

        best

        fmin

    end

    fitnessMSE(t) = fmin;

end

%figure, plot(1:N_iter,fitnessMSE);

% Output/display

disp(['Total number of eval(N_iter*n)]);

disp(['Best solution=',num2str(best),'   fmin=',num2str(fmin)]);

figure(1)

plot( fitnessMSE)

xlabel('Iteration');

ylabel('Best score obtained so far');

3 運行結果

matlab怎么實現圖像的自適應多閾值快速分割

以上就是“matlab怎么實現圖像的自適應多閾值快速分割”這篇文章的所有內容,感謝各位的閱讀!相信大家閱讀完這篇文章都有很大的收獲,小編每天都會為大家更新不同的知識,如果還想學習更多的知識,請關注億速云行業資訊頻道。

向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

东丽区| 北票市| 怀化市| 奎屯市| 托克逊县| 鄂州市| 福清市| 宁海县| 峨山| 临泉县| 镇原县| 会昌县| 武定县| 兴和县| 新乡市| 黄平县| 格尔木市| 房产| 彰武县| 苏州市| 寿宁县| 济阳县| 光山县| 商城县| 东方市| 尼勒克县| 隆德县| 阿坝| 贵南县| 汉川市| 吴桥县| 台东市| 郧西县| 龙胜| 民县| 永清县| 乐山市| 五寨县| 凯里市| 多伦县| 上犹县|