• 大小: 3.03MB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2023-08-11
  • 语言: Matlab
  • 标签: matlab  

资源简介

偏微分方程在图形图像处理中的应用(matlab代码) 偏微分方程在图形图像处理中的应用(matlab代码)

资源截图

代码片段和文件信息

%---------------------------------------------%
%       %
%          工作室提供代做matlab仿真       %
%       %
%  详情请访问:http://cn.mikecrm.com/5k6v1DP  %
%       %
%---------------------------------------------%
%%% This program implement image interpolation by AMLE method. Firstly get
%%% a number of level sets from an input image by thresholdding. The threshold
%%% values are chosen automatically. Then the boundaries for each level set
%%% are extracted the image data on the boundaries are recorded. Finally 
%%% by using AMLE extend those imformation to reconstract a new image
%%% which will approximate the original one quitr well.

clear all;
close all;
clc;

Img = imread(‘lady.bmp‘);
Img=rgb2gray(Img);

figure(1);imshow(uint8(Img));
[ny nx] = size(Img);

N=12;                          % A presetting parameter--Number of level_sets
h=imhist(Img)/(ny*nx);
D_max([1:N])=0;                 
count([1:N])=0;                
start=0;s=0.0; 
for n=1:N 
   for d=start:255             
       if h(d+1)>0
          count(n)=count(n)+1;
          s=s+h(d+1);
          if s>=double(n/N)          
              D_max(n)=d-1;           
              count(n)=count(n)-1;    
              s=s-h(d+1);             
              start=d;                
              break;                  
          end
       end
   end
end
count(N)=count(N)+1;
D_max(N)=D_max(N)+1;
nn=0;
for n=1:N
   if count(n)>0
      nn=nn+1;
      D_max(nn)=D_max(n);
   end
end 
% Now nn is the number of level_sets

Level_Set_Boundary=zeros([ny nx]);  %Recode boundares only for display
Boundary_Img=zeros([ny nx]);        %Recode the gray values of the image on the boundares

for n=1:nn
    bw=zeros([ny nx]);
    if n==1;
        D_min=0;
    else
        D_min=D_max(n-1)+1;
    end
    for i=1:ny
        for j=1:nx
            if Img(ij)>=D_min 
               bw(ij)=1; 
            end
        end
    end
    
    se = strel(‘disk‘5);          % Set a stracturing elememt
    BW2 = imopen(bwse);           % Make open opartion to the level sets
        
    B = bwboundaries(BW2);         % Get boundaries
    for i = 1:length(B)
        boundary=B{i};
        L=length(boundary);
        for ii=1:L
            xx=boundary(ii2);                % Get positions of the boundary points
            yy=boundary(ii1);
            Level_Set_Boundary(yyxx)=1;      % Recode the positions for diplay only.
            Boundary_Img(yyxx)=Img(yyxx);   % Recode the image data for extension.
            
        end
    end
end
figure(2);imshow(Level_Set_Boundary);
figure(3);imshow(uint8(Boundary_Img));

Diff_Img=120+50*randn([ny nx]);             % Randon intialization
[nrow ncol]=size(Diff_Img); 

delt=0.2;
% Iteration begin here
for n=1:300
    I_x = (Diff_Img(:[2:ncol ncol])-Diff_Img(:[1 1:ncol-1]))/2;
    I_y = (Diff_Img([2:nrow nrow]:)-Diff_Img([1 1:nrow-1]:))/2;
    I_xx = D

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2019-04-08 16:23  偏微分方程在图形图像处理中的应用(matlab代码)\
     目录           0  2019-04-08 16:23  偏微分方程在图形图像处理中的应用(matlab代码)\Color Images\
     文件      196662  2003-11-07 19:54  偏微分方程在图形图像处理中的应用(matlab代码)\Color Images\Autumn.bmp
     文件       45414  2007-12-09 17:14  偏微分方程在图形图像处理中的应用(matlab代码)\Color Images\balloon.bmp
     文件      196662  2003-11-07 20:19  偏微分方程在图形图像处理中的应用(matlab代码)\Color Images\Bird.bmp
     文件      196662  2003-11-07 19:54  偏微分方程在图形图像处理中的应用(matlab代码)\Color Images\Bridge.bmp
     文件      196662  2003-11-07 19:55  偏微分方程在图形图像处理中的应用(matlab代码)\Color Images\Butterfly.bmp
     文件       65938  2007-12-09 15:09  偏微分方程在图形图像处理中的应用(matlab代码)\Color Images\castle.bmp
     文件      196662  2003-11-07 19:53  偏微分方程在图形图像处理中的应用(matlab代码)\Color Images\Eagle.bmp
     文件      196662  2003-11-06 00:22  偏微分方程在图形图像处理中的应用(matlab代码)\Color Images\fighter.bmp
     文件        6294  2007-12-09 15:53  偏微分方程在图形图像处理中的应用(matlab代码)\Color Images\lake.bmp
     文件      436350  2007-04-29 16:40  偏微分方程在图形图像处理中的应用(matlab代码)\Color Images\nebula.bmp
     文件      196662  2003-11-07 20:21  偏微分方程在图形图像处理中的应用(matlab代码)\Color Images\Panda.bmp
     文件      196662  2003-11-06 00:25  偏微分方程在图形图像处理中的应用(matlab代码)\Color Images\pepper.bmp
     文件       69750  2007-12-09 17:10  偏微分方程在图形图像处理中的应用(matlab代码)\Color Images\rose.bmp
     文件       93654  2007-12-09 17:15  偏微分方程在图形图像处理中的应用(matlab代码)\Color Images\toy.bmp
     文件       60402  2007-11-03 16:17  偏微分方程在图形图像处理中的应用(matlab代码)\Color Images\TV_color_square.bmp
     文件        9846  2007-09-16 10:12  偏微分方程在图形图像处理中的应用(matlab代码)\Color Images\water_lilies.bmp
     目录           0  2019-04-08 16:23  偏微分方程在图形图像处理中的应用(matlab代码)\Gray Images\
     文件      120054  2006-04-22 13:07  偏微分方程在图形图像处理中的应用(matlab代码)\Gray Images\3.bmp
     文件       41214  2007-12-03 10:19  偏微分方程在图形图像处理中的应用(matlab代码)\Gray Images\brain.bmp
     文件       77494  2007-12-10 09:35  偏微分方程在图形图像处理中的应用(matlab代码)\Gray Images\brain_v.bmp
     文件       66614  2003-11-07 22:16  偏微分方程在图形图像处理中的应用(matlab代码)\Gray Images\Carving.bmp
     文件       17462  2003-05-05 23:22  偏微分方程在图形图像处理中的应用(matlab代码)\Gray Images\chrom.bmp
     文件      161982  2007-03-24 16:20  偏微分方程在图形图像处理中的应用(matlab代码)\Gray Images\computer2.bmp
     文件       69366  2006-11-12 20:57  偏微分方程在图形图像处理中的应用(matlab代码)\Gray Images\cv1.bmp
     文件       49206  2007-12-09 15:23  偏微分方程在图形图像处理中的应用(matlab代码)\Gray Images\cv2.bmp
     文件       76854  2007-12-09 16:40  偏微分方程在图形图像处理中的应用(matlab代码)\Gray Images\gac1.bmp
     文件       17462  2003-05-05 23:22  偏微分方程在图形图像处理中的应用(matlab代码)\Gray Images\I_C.bmp
     文件      196662  2007-10-04 09:21  偏微分方程在图形图像处理中的应用(matlab代码)\Gray Images\lady.bmp
     文件       66614  2003-05-05 23:22  偏微分方程在图形图像处理中的应用(matlab代码)\Gray Images\lenna.bmp
............此处省略27个文件信息

评论

共有 条评论