| 查看: 499 | 回复: 0 | ||
[求助]
在线求助 大神帮我看一下 这段程序有什么问题 紧急!!!!!!
|
|
function idisp(z, clip, ncmap) if nargin < 3, % ncmap = 64; ncmap = 256; end if (nargin > 0) & ~isstr(z), clf colormap(gray(ncmap)) n = ncmap; if nargin == 2, if length(clip) == 2, z(find(z<clip(1))) = clip(1); z(find(z>clip(2))) = clip(2); elseif length(clip) == 1, z(find(z>clip)) = clip; end end hi = image(z); hh = max(max(z)); mm = min(min(z)); [r1 c1] = find(z == hh); [r2 c2] = find(z == mm); set(hi, 'CDataMapping', 'scaled'); htf = uicontrol(gcf, ... 'style', 'text', ... 'units', 'norm', ... 'pos', [.8 .93 .2 .07], ... 'string', '' ... ); htf1= uicontrol(gcf, ... 'style', 'text', ... 'units', 'norm', ... 'pos', [0 0 0.2 .06], ... 'string', '' ... ); htf2= uicontrol(gcf, ... 'style', 'text', ... 'units', 'norm', ... 'pos', [0.7 0 0.3 .06], ... 'string', '' ... ); ud = [gca htf hi axis htf2 r2(1) c2(1) mm htf1 r1(1) c1(1) hh]; set(gca, 'UserData', ud); set(hi, 'UserData', ud); hpb=uicontrol(gcf,'style','push','string','line', ... 'units','norm','pos',[0 .93 .1 .07], ... 'userdata', ud, ... 'callback', 'idisp(''line'')'); hzm=uicontrol(gcf,'style','push','string','zoom', ... 'units','norm','pos',[.1 .93 .1 .07], ... 'userdata', ud, ... 'callback', 'idisp(''zoom'')'); huz=uicontrol(gcf,'style','push','string','unzoom', ... 'units','norm','pos',[.2 .93 .15 .07], ... 'userdata', ud, ... 'callback', 'idisp(''unzoom'')'); set(hi, 'UserData', ud); set(gcf, 'WindowButtonDownFcn', 'idisp(''down'')'); set(gcf, 'WindowButtonUpFcn', 'idisp(''up'')'); return; end if nargin == 0, h = get(gcf, 'CurrentObject'); % image ud = get(h, 'UserData'); % axis h_ax = ud(1); % axes tf = ud(2); % string field hi = ud(3); % the image cp = get(h_ax, 'CurrentPoint'); x = round(cp(1,1)); y = round(cp(1,2)); imdata = get(hi, 'CData'); set(tf, 'String', ['(' num2str(y) ', ' num2str(x) ') = ' num2str(imdata(y,x))]); htf1 = ud(end-3); r1 = ud(end-2); c1 = ud(end-1); hh = ud(end); htf2 = ud(end-7); r2 = ud(end-6); c2 = ud(end-5); mm = ud(end-4); set(htf1, 'String', ['(' num2str(r1) ', ' num2str(c1) ') = ' num2str(hh)]); set(htf2, 'String', ['(' num2str(r2) ', ' num2str(c2) ') = ' num2str(mm)]); drawnow elseif nargin == 1, switch z, case 'down', % install pixel value inspector set(gcf, 'WindowButtonMotionFcn', 'idisp'); idisp case 'up', set(gcf, 'WindowButtonMotionFcn', ''); case 'line', h = get(gcf, 'CurrentObject'); % push button ud = get(h, 'UserData'); ax = ud(1); % axes tf = ud(2); % string field hi = ud(3); % the image set(tf, 'String', 'First point'); [x1,y1] = ginput(1); x1 = round(x1); y1 = round(y1); set(tf, 'String', 'Last point'); [x2,y2] = ginput(1); x2 = round(x2); y2 = round(y2); set(tf, 'String', ''); imdata = get(hi, 'CData'); dx = x2-x1; dy = y2-y1; if abs(dx) > abs(dy), x = min(x1,x2):max(x1,x2); y = round(dy/dx * (x-x1) + y1); nim = size(x,2); for kn = 1:nim imgout(kn) = imdata(y(kn),x(kn)); end figure;plot(x,imgout); xlabel('Coordinate (X)') else y = min(y1,y2):max(y1,y2); x = round(dx/dy * (y-y1) + x1); nim = size(y,2); for kn = 1:nim imgout(kn) = imdata(y(kn),x(kn)); end figure;plot(y,imgout); xlabel('Coordinate (Y)') end case 'zoom', h = get(gcf, 'CurrentObject'); % push button ud = get(h, 'UserData'); ax = ud(1); % axes tf = ud(2); % string field hi = ud(3); % the image set(tf, 'String', 'First point'); [x1,y1] = ginput(1); x1 = round(x1); y1 = round(y1); set(tf, 'String', 'Last point'); [x2,y2] = ginput(1); x2 = round(x2); y2 = round(y2); set(tf, 'String', ''); axes(ax); axis([x1 x2 y1 y2]); case 'unzoom', h = get(gcf, 'CurrentObject'); % push button ud = get(h, 'UserData'); h_ax = ud(1); % axes axes(h_ax); axis(ud(4:7)); end end |
» 猜你喜欢
有没有人能给点建议
已经有5人回复
假如你的研究生提出不合理要求
已经有12人回复
实验室接单子
已经有7人回复
全日制(定向)博士
已经有5人回复
萌生出自己或许不适合搞科研的想法,现在跑or等等看?
已经有4人回复
Materials Today Chemistry审稿周期
已经有4人回复
参与限项
已经有3人回复
对氯苯硼酸纯化
已经有3人回复
所感
已经有4人回复
要不要辞职读博?
已经有7人回复
找到一些相关的精华帖子,希望有用哦~
求助大神~ 关于复函数与模拟
已经有5人回复
求助大神们解决GC测样出现的问题
已经有4人回复
求大神帮检查下一个简单的UDF
已经有13人回复
请问下面这段c++小程序为什么不能运行
已经有6人回复
优势菌群是怎么定义的?请各位大神帮忙啊
已经有7人回复
请解释一下这段话。关于能带简并的。谢谢
已经有11人回复
求助 EC50 怎么算!!!! 求大神帮忙
已经有3人回复
求助quantum-espresso使用问题!
已经有5人回复
求助CATIA大神
已经有5人回复
关于配位数的问题
已经有4人回复
帮我看一下是什么意思,删除之前投的吗?
已经有3人回复
52单片机的程序问题,程序刚开始可以执行,可是执行一段时间后就不灵敏了!求高人指点
已经有3人回复
fluent问题急求大神帮助!!!
已经有4人回复
动网格的UDF问题
已经有21人回复
求大神赐教一下matlab光学仿真的一程序。
已经有8人回复
求助大神帮我看看这段程序是干什么的?(就是定义这个函数算什么)
已经有6人回复
大家爱帮我看看这段MATLAB程序为啥出错了
已经有5人回复
请问大牛 'TRACKING' FEATURE 是什么意思,急求答案,谢谢
已经有19人回复
请大家帮我看看怎么回复这样的proof,在线等。急!
已经有5人回复
科研从小木虫开始,人人为我,我为人人












回复此楼
点击这里搜索更多相关资源