⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 showimage.m

📁 matlab处理图像的一些基本方法。其中有一部分mex程序需要安装编译
💻 M
字号:
function showimage%SHOWIMAGE - Displays the current image in the mode set in the View menu.%%% Copyright (c) 1995 by Claudio Rivetti and Mark Young% claudio@alice.uoregon.edu,    mark@alice.uoregon.edu%global H I Handleimg Handlebar Handleimgax Handlefig HandleIimgglobal Fname FontName FontSize FontWeight global FullFname LineSpace PlaneSpace ViewCoord MapSize mapglobal ZoomFactor Center Oldzoomstatus  nmaxglobal img TVzrange D3zrange ContourLines SelObj msm edgem facemglobal tag B_frame T Fast3Dplotif isempty(I)  return;endif isempty(Fast3Dplot) Fast3Dplot=1;endif isempty(PlaneSpace) PlaneSpace=0;end% T is the orientation matrix set by the viewer;if isempty(T)T=[0.7986 -0.6018 0 0;   0.3009 0.3993 0.8660 0;   -0.5212 -0.6916 0.5000 0;   0 0 0 1.0000];endZAMPLITUDE=10;fig=watchon;set(Handlefig, 'nextplot', 'add');if strcmp(getviewmode, 'TOPVIEW')  if ~isimage    tag='';    if ~ischildren(HandleIimg, Handleimgax)	  zrange(TVzrange);    end    D3zrange=zrange;	[ss, units]=scansize(H);xo=xoffset(H);yo=yoffset(H);	px=size(I);    xlim=[xo+(ss/px(2))/2 xo+ss-(ss/px(2))/2];    ylim=[yo+(ss/px(1))/2 yo+ss-(ss/px(1))/2];    Handleimg=image(xlim, ylim, scaleimage(I, zrange));    setimagescale(Handleimgax,[xo xo+ss],[yo yo+ss], units);    ViewCoord=[];%    closeviewer;    setbarscale(zrange);    if ~isempty(ZoomFactor)%      zoom(ZoomFactor, Center);      zoom(ZoomFactor);      ZoomFactor=[];      setzoomstatus(Oldzoomstatus);    end  else    set(Handleimg, 'Cdata', scaleimage(I, zrange));    setbarscale(zrange);  endendif strcmp(getviewmode, 'TOPVIEW_INTERP')  tag='';  if isimage    [ZoomFactor, Center]=getzoom(Handleimgax);    Oldzoomstatus=getzoomstatus;    [img ViewCoord]=getview;    img=flipud(img);	if prod(size(img)) > 10000 & Fast3Dplot	  img=imresize(img, [100 100], 'bicubic');	end    nmax = axis;  else    if ~ischildren(HandleIimg,Handleimgax)    	closebuttons;    end  end  HandleIimg=pcolor(img);caxis(zrange);shading interp;axis off;%  closeviewer;  setbarscale(caxis);endif strcmp(getviewmode, 'LINEPLOT')  if isimage    [ZoomFactor, Center]=getzoom(Handleimgax);    Oldzoomstatus=getzoomstatus;    TVzrange=zrange;    zrange(D3zrange);    setzoomstatus(-1);    [img ViewCoord]=getview(ViewCoord);    img=flipud(img);  end  if strcmp(tag, 'Line Plot') ~= 1    tag=meshc_buttons('Line Plot');  end  w=waterfall(PlaneSpace+img(1:LineSpace:size(img,1),:));  set(w, 'linewidth', getlinewidth);  if get(edgem, 'value')==4, set(w,'EdgeColor', getpencolor); else, set(w,'EdgeColor', get(edgem,'userdata'));end  if get(facem, 'value')<4, set(w,'FaceColor', get(facem,'userdata'));end  if get(facem, 'value')==5, set(w, 'FaceColor', getfillcolor);end  if get(facem, 'value')==4, set(w, 'FaceColor', 'none');end    view(T);  axis off;  set(gca, 'zlim', zrange);  setbarscale(caxis);  viewer;  SelObj=w;endif strcmp(getviewmode, 'MESH')  if isimage    [ZoomFactor, Center]=getzoom(Handleimgax);    Oldzoomstatus=getzoomstatus;    TVzrange=zrange;    zrange(D3zrange);    setzoomstatus(-1);    [img ViewCoord]=getview(ViewCoord);    img=flipud(img);	if prod(size(img)) > 10000 & Fast3Dplot	  img=imresize(img, [100 100], 'bicubic');	end  end  if strcmp(tag, 'Mesh Plot') ~= 1    tag=meshc_buttons('Mesh Plot');  end  m=mesh(PlaneSpace+img(1:LineSpace:size(img,1),1:LineSpace:size(img,2)));  set(m, 'linestyle', getlinestyle, 'linewidth', getlinewidth, 'meshstyle', get(msm,'userdata'));  if get(edgem, 'value')==4, set(m,'EdgeColor', getpencolor); else, set(m,'EdgeColor', get(edgem,'userdata'));end  if get(facem, 'value')==5, set(m,'FaceColor', getfillcolor); else, set(m,'FaceColor', get(facem,'userdata'));end  view(T);  axis off;  set(gca, 'zlim', zrange);  setbarscale(caxis);  viewer;  SelObj=m;endif strcmp(getviewmode, 'MESHC')  if isimage    [ZoomFactor, Center]=getzoom(Handleimgax);    Oldzoomstatus=getzoomstatus;    TVzrange=zrange;    zrange(D3zrange);    setzoomstatus(-1);    [img ViewCoord]=getview(ViewCoord);    img=flipud(img);	if prod(size(img)) > 10000 & Fast3Dplot	  img=imresize(img, [100 100], 'bicubic');	end  end  m=meshc(PlaneSpace+img(1:LineSpace:size(img,1),1:LineSpace:size(img,2)));  view(T);  ContourLines=m(2:length(m));  zpos=zrange;  zpos=zpos(1);  for i = 1:length(ContourLines)    zz = get(ContourLines(i),'Zdata');    set(ContourLines(i),'Zdata',zpos*ones(size(zz)), 'linestyle', getlinestyle, 'linewidth', getlinewidth);  end  if strcmp(tag, 'Mesh/Contour Plot') ~=1    tag=meshc_buttons('Mesh/Contour Plot');  end  set(m(1), 'linestyle', getlinestyle, 'linewidth', getlinewidth, 'meshstyle', get(msm,'userdata'));  if get(edgem, 'value')==4, set(m(1), 'EdgeColor', getpencolor); else, set(m(1), 'EdgeColor', get(edgem,'userdata'));end  if get(facem, 'value')==5, set(m(1), 'FaceColor', getfillcolor); else, set(m(1),'FaceColor', get(facem,'userdata'));end  axis off;  set(Handleimgax, 'zlim', zrange);  setbarscale(caxis);  viewer;  SelObj=[ContourLines;m];endif strcmp(getviewmode, 'SURFACE')  if isimage    [ZoomFactor, Center]=getzoom(Handleimgax);    Oldzoomstatus=getzoomstatus;    TVzrange=zrange;    zrange(D3zrange);    setzoomstatus(-1);    [img ViewCoord]=getview(ViewCoord);    img=flipud(img);	if prod(size(img)) > 10000 & Fast3Dplot	  img=imresize(img, [100 100], 'bicubic');	end  end  if strcmp(tag, 'Surface Plot') ~= 1    tag=meshc_buttons('Surface Plot');  end  m=surf(PlaneSpace+img);  set(m, 'linestyle', getlinestyle, 'linewidth', getlinewidth);  if get(edgem, 'value')==4, set(m,'EdgeColor', getpencolor); else, set(m,'EdgeColor', get(edgem,'userdata'));end  if get(facem, 'value')==5, set(m,'FaceColor', getfillcolor); else, set(m,'FaceColor', get(facem,'userdata'));end  view(T);  axis off;  set(gca, 'zlim', zrange);  setbarscale(caxis);  viewer;endif strcmp(getviewmode, 'SURFL')  if isimage    [ZoomFactor, Center]=getzoom(Handleimgax);    Oldzoomstatus=getzoomstatus;    TVzrange=zrange;    zrange(D3zrange);    setzoomstatus(-1);    [img ViewCoord]=getview(ViewCoord);    img=flipud(img);	if prod(size(img)) > 10000 & Fast3Dplot	  img=imresize(img, [100 100], 'bicubic');	end  end  if strcmp(tag, 'SurfaceL Plot') ~= 1    tag=meshc_buttons('SurfaceL Plot');  end  m=surfl(PlaneSpace+img);  set(m, 'linestyle', getlinestyle, 'linewidth', getlinewidth);  if get(edgem, 'value')==4, set(m,'EdgeColor', getpencolor); else, set(m,'EdgeColor', get(edgem,'userdata'));end  if get(facem, 'value')==5, set(m,'FaceColor', getfillcolor); else, set(m,'FaceColor', get(facem,'userdata'));end  view(T);  axis off;  set(gca, 'zlim', zrange);  setbarscale([]);  viewer;endwatchoff(fig);set(Handlefig, 'nextplot', 'new');return;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -