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

首頁 > 行業(yè)資訊 > 【元胞自動機(jī)】基于元胞自動機(jī)實(shí)現(xiàn)藝術(shù)圖像處理附matlab代碼

【元胞自動機(jī)】基于元胞自動機(jī)實(shí)現(xiàn)藝術(shù)圖像處理附matlab代碼

時間:2023-02-07 來源: 瀏覽:

【元胞自動機(jī)】基于元胞自動機(jī)實(shí)現(xiàn)藝術(shù)圖像處理附matlab代碼

天天Matlab 天天Matlab
天天Matlab

TT_Matlab

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

收錄于合集 #元胞自動機(jī)應(yīng)用matlab源碼 70個

1 內(nèi)容介紹

元胞自動機(jī)變換為我們提供了一個將已知現(xiàn)象和元胞自動機(jī)演化聯(lián)系起來的直接方法.它將物理網(wǎng)格空間上的每個點(diǎn)通過元胞自動機(jī)變換基映射到元胞自動機(jī)空間上,通過元胞自動機(jī)空間上的變換系數(shù)揭示出物理空間中很難觀察到的性質(zhì).元胞自動機(jī)變換最大的優(yōu)勢是能產(chǎn)生大量的不同性質(zhì)的基函數(shù),這些基函數(shù)可以適應(yīng)已知問題的各種特性,為圖像壓縮,數(shù)據(jù)加密,求解積分方程等方面的應(yīng)用提供一個良好的平臺. 本文先對元胞自動機(jī)變換的發(fā)展情況和元胞自動機(jī)變換的基本方法作了簡要的介紹,在此基礎(chǔ)上把元胞自動機(jī)變換應(yīng)用到圖像處理中。

2 仿真代碼

function [ opImgCell ] = CAPainting( Img, mu, lambda, Generation, Boundary )

%CAPAINTING Summary of this function goes here

%   Detailed explanation goes here

Img = double(Img);

Sz = size(Img);

Pop = cell(1, mu+lambda);

Result = cell(1, mu+lambda);

if exist(’Save’, ’dir’) ~= 7

    mkdir(’Save’);

end

% initialize first population

for i=1:mu+lambda

    if i<= mu

        Pop{i} = cell(1, 7);

        Pop{i}{1} = randi([1, Boundary{1}], 1, 3); % Birth

        Pop{i}{2} = randi([1, Boundary{2}], 1, 3); % Level

        Pop{i}{3} = randi([1, Boundary{3}], 1, 3); % number of Pattern Pos

        Pop{i}{6} = randi([Boundary{4}, Boundary{5}], 1, 3); % Cell Generation

        Pop{i}{4} = cell(1, 3); % PosH

        Pop{i}{5} = cell(1, 3); % PosW

        Pop{i}{7} = cell(1, 3); % Pattern

        for j=1:3

            Pop{i}{4}{j} = randi([1, Boundary{6}], 1, Pop{i}{3}(j));  

            Pop{i}{5}{j} = randi([1, Boundary{7}], 1, Pop{i}{3}(j));

            Pop{i}{7}{j} = randi([0, 1],2*Pop{i}{2}(j)+1, 2*Pop{i}{2}(j)+1);

        end

        Result{i} = zeros(Sz);

        for cc=1:3

         [Result{i}(:, :, cc), ta, tb, tc, td, te] = GUILogicRule(Img, cc, Pop{i}{1}(cc), Pop{i}{2}(cc), Pop{i}{3}(cc), Pop{i}{6}(cc), 1, Pop{i}{4}{cc}, Pop{i}{5}{cc}, Pop{i}{7}{cc});

        end

    else

        Pop{i} = cell(1, 7);

        Result{i} = zeros(Sz);

    end

end

% end initialize    

Fit = Fitness(Result);

for g=1:Generation

    % tournament size = 2;

    SelCounter = 1;

    selectMutation = zeros(1, mu);

    for sel=1:mu

        selectArray = randi([1, mu], 1, 2);

        if Fit(selectArray(1)) > Fit(selectArray(2))

            selectMutation(SelCounter) = selectArray(1);

            SelCounter = SelCounter +1;

        else

            selectMutation(SelCounter) = selectArray(2);

            SelCounter = SelCounter +1;

        end

    end

    for mutate=1:lambda

        [Pop{mu+mutate}, cc] = Mutation(Pop{selectMutation(mutate)}, Boundary);

        Result{mu+mutate} = Result{selectMutation(mutate)};

        [Result{mu+mutate}(:, :, cc), ta, tb, tc, td, te] = GUILogicRule(Img, cc, Pop{mu+mutate}{1}(cc), Pop{mu+mutate}{2}(cc), Pop{mu+mutate}{3}(cc), Pop{mu+mutate}{6}(cc), 1, Pop{mu+mutate}{4}{cc}, Pop{mu+mutate}{5}{cc}, Pop{mu+mutate}{7}{cc});

    end    

    Fit = Fitness(Result);

    % survivor selection

    [Fit,sortIndex] = sort(Fit(:),’descend’); 

    Fit = [Fit(1:mu)’, zeros(1, lambda)];

    selectParent = sortIndex(1:mu);   

    newPop = cell(1, mu+lambda);

    newRes = cell(1, mu+lambda);

    for wrt=1:mu+lambda

        if wrt <= mu

            imwrite(Result{wrt}, [’Save/G’, num2str(g), ’Parent’, num2str(wrt), ’.jpg’]);

        else

            imwrite(Result{wrt}, [’Save/G’, num2str(g), ’Child’, num2str(wrt-mu), ’.jpg’]);

        end

    end

    for i=1:mu+lambda

        if i<= mu

            newPop{i} = Pop{selectParent(i)};

            newRes{i} = Result{selectParent(i)};

        else

            newPop{i} = cell(1, 7);

            newRes{i} = zeros(Sz);

        end

    end

    Pop = newPop;

    Result = newRes;

end

opImgCell = Result;

end

3 運(yùn)行結(jié)果

4 參考文獻(xiàn)

[1]李輝亮. 基于元胞自動機(jī)的數(shù)字圖像處理[D]. 汕頭大學(xué), 2007.

博主簡介:擅長智能優(yōu)化算法、神經(jīng)網(wǎng)絡(luò)預(yù)測、信號處理、元胞自動機(jī)、圖像處理、路徑規(guī)劃、無人機(jī)等多種領(lǐng)域的Matlab仿真,相關(guān)matlab代碼問題可私信交流。

部分理論引用網(wǎng)絡(luò)文獻(xiàn),若有侵權(quán)聯(lián)系博主刪除。

版權(quán):如無特殊注明,文章轉(zhuǎn)載自網(wǎng)絡(luò),侵權(quán)請聯(lián)系cnmhg168#163.com刪除!文件均為網(wǎng)友上傳,僅供研究和學(xué)習(xí)使用,務(wù)必24小時內(nèi)刪除。
相關(guān)推薦