【图像重建】基于遗传算法实现二值图像重建附matlab代码

1 内容介绍

图像质量的优劣对人类视觉和各种计算机视觉系统都十分重要,因此图像复原一直是数字图像处理的重要研究内容。作为图像复原的一个分支,超分辨率图像重建问题得到人们越来越多的关注。在视频监控、卫星成像和医学诊断等应用中,由于物理条件的限制,人们获得的图像分辨率较低,无法满足实际需要。超分辨率图像重建技术就是利用这些低分辨率图像序列中各帧图像之间的冗余信息,重构出高分辨率图像。 提出了一种基于遗传算法的图象重建算法,该算法通过构造合适的基因编码方案及个体适应度评价函数,并对遗传算法进行优化,克服了Kuba算法和谷士文AI算法的缺陷,可以成功地解决由带有噪声的二维正交投影重建二维图象的问题,并简化了约束条件.实验结果表明该算法是成功有效的.​

2 仿真代码

% Written by Dr. Seyedali Mirjalili

% To watch videos on this algorithm, enrol to my courses with 95% discount using the following links: 

% ************************************************************************************************************************************************* 

%  A course on "Optimization Problems and Algorithms: how to understand, formulation, and solve optimization problems": 

%  https://www.udemy.com/optimisation/?couponCode=MATHWORKSREF

% ************************************************************************************************************************************************* 

%  "Introduction to Genetic Algorithms: Theory and Applications" 

%  https://www.udemy.com/geneticalgorithm/?couponCode=MATHWORKSREF

% ************************************************************************************************************************************************* 

function [BestChrom]  = GeneticAlgorithm (M , N, MaxGen , Pc, Pm , Er , obj, visuailzation)

load IMG_REF_BINARY;

cgcurve = zeros(1 , MaxGen);

%%  Initialization

[ population ] = initialization(M, N);

for i = 1 : M

    population.Chromosomes(i).fitness = obj( population.Chromosomes(i).Gene(:), IMG_REF_BINARY);

end

g = 1;

disp(['Generation #' , num2str(g)]);

[max_val , indx] = sort([ population.Chromosomes(:).fitness ] , 'descend');

cgcurve(g) = population.Chromosomes(indx(1)).fitness;

subplot(1,2,2)

%% Main loop

for g = 2 : MaxGen

    disp(['Generation #' , num2str(g)]);

    for k = 1: 2: M

        % Selection

        [ parent1, parent2] = selection(population);

        

        % Crossover

        [child1 , child2] = crossover(parent1 , parent2, Pc, 'double');

        

        % Mutation

        [child1] = mutation(child1, Pm);

        [child2] = mutation(child2, Pm);

        

        newPopulation.Chromosomes(k).Gene = child1.Gene;

        newPopulation.Chromosomes(k+1).Gene = child2.Gene;

    end

    

    % Calcualte the fitness values

    for i = 1 : M

        newPopulation.Chromosomes(i).fitness = obj( newPopulation.Chromosomes(i).Gene(:), IMG_REF_BINARY);

    end

    

    % Elitism

    [ newPopulation ] = elitism(population, newPopulation, Er);

    

    cgcurve(g) = newPopulation.Chromosomes(1).fitness;

    

    population = newPopulation; % Replace the previous population with the newly made

    

    BestChrom.Gene    = population.Chromosomes(1).Gene;

    BestChrom.Fitness = population.Chromosomes(1).fitness;

    

    

    col_no = size(IMG_REF_BINARY,2);

    Recons_IMG = vec2mat(BestChrom.Gene , col_no);

    Recons_IMG = Recons_IMG .* 255;

    

 %   if rem(g , 100) == 0

        subplot(1,2,2)

        imshow(Recons_IMG);

        title(['Generation #' , num2str(g), ' Error = ' , num2str(-BestChrom.Fitness)])

        drawnow

 %   end

    

end

   

if visuailzation == 1

    figure

    plot( 1 : MaxGen , cgcurve);

    xlabel('Generation');

    ylabel('Fitness of the best elite')

end

end

3 运行结果

4 参考文献

[1]伍晓平, 谷士文, 费耀平,等. 基于遗传算法的图象重建算法[J]. 计算技术与自动化, 2000, 19(1):4.

博主简介:擅长智能优化算法、神经网络预测、信号处理、元胞自动机、图像处理、路径规划、无人机等多种领域的Matlab仿真,相关matlab代码问题可私信交流。

部分理论引用网络文献,若有侵权联系博主删除。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
CT图像重建是医学成像领域中重要的操作之一,SART算法是一种常用的重建算法,它能够通过迭代的方式逐步优化原始投影数据,从而得到高质量的CT图像。在MATLAB实现SART算法的代码如下: ```Matlab function reconImg = SART(imageSize, projections, numIterations) numAngles = size(projections, 3); reconImg = zeros(imageSize); weights = zeros(imageSize); for iter = 1 : numIterations for angle = 1 : numAngles projection = projections(:,:,angle); backprojection = radonsum(reconImg, angle, 1); correction = projection ./ (backprojection + eps ); correction(isnan(correction)) = 0; weights = weights + iradonsum(correction, angle, 0); reconImg = reconImg + iradonsum(correction .* backprojection, angle, 0); end reconImg = reconImg ./ (weights + eps); reconImg(isnan(reconImg)) = 0; end end function sinogram = radonsum(image, angle, interpMethod) [nRows, nCols] = size(image); sinogram = zeros(nRows,1); for row = 1 : nRows sinogram(row) = sum(interp1(1:nCols, image(row,:), 1:nCols, interpMethod)); end end function backprojection = iradonsum(sinogram, angle, interpMethod) [nRows, nCols] = size(sinogram); backprojection = zeros(nRows,nCols); for row = 1 : nRows backprojection(row,:) = interp1(1:nCols, sinogram(row,:), 1:nCols, interpMethod); end end ``` 以上的MATLAB代码实现了SART算法的基本思路,通过多次迭代更新投影数据的权重和回投影图像,并最终得到重建后的CT图像。这段代码可以通过MATLAB进行编译执行,以实现CT图像重建工作。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

matlab科研助手

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值