| 1 | 1/1 | 返回列表 |
| 查看: 516 | 回復(fù): 0 | ||
sacredli新蟲 (初入文壇)
|
[求助]
在線求助 大神幫我看一下 這段程序有什么問題 緊急。。。。!
|
|
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 |
找到一些相關(guān)的精華帖子,希望有用哦~
| 1 | 1/1 | 返回列表 |
| 最具人氣熱帖推薦 [查看全部] | 作者 | 回/看 | 最后發(fā)表 | |
|---|---|---|---|---|
|
[考研] 290求調(diào)劑 +5 | ^O^乜 2026-03-19 | 5/250 |
|
|---|---|---|---|---|
|
[考研]
|
簡木ChuFront 2026-03-19 | 8/400 |
|
|
[考研] 265求調(diào)劑 +8 | 梁梁校校 2026-03-17 | 8/400 |
|
|
[考研] 材料專碩英一數(shù)二306 +6 | z1z2z3879 2026-03-18 | 6/300 |
|
|
[考研] 材料學(xué)碩318求調(diào)劑 +5 | February_Feb 2026-03-19 | 5/250 |
|
|
[考研] 294求調(diào)劑材料與化工專碩 +14 | 陌の森林 2026-03-18 | 14/700 |
|
|
[考研] 一志愿天津大學(xué)化學(xué)工藝專業(yè)(081702)315分求調(diào)劑 +11 | yangfz 2026-03-17 | 11/550 |
|
|
[考研] 一志愿985,本科211,0817化學(xué)工程與技術(shù)319求調(diào)劑 +10 | Liwangman 2026-03-15 | 10/500 |
|
|
[考研] 311求調(diào)劑 +4 | 冬十三 2026-03-18 | 4/200 |
|
|
[考研] 328求調(diào)劑,英語六級551,有科研經(jīng)歷 +3 | 生物工程調(diào)劑 2026-03-17 | 7/350 |
|
|
[考研] 化學(xué)工程321分求調(diào)劑 +15 | 大米飯! 2026-03-15 | 18/900 |
|
|
[考研] 302求調(diào)劑 +10 | 呼呼呼。。。。 2026-03-17 | 10/500 |
|
|
[考研] 0703化學(xué)336分求調(diào)劑 +6 | zbzihdhd 2026-03-15 | 7/350 |
|
|
[考研] 301求調(diào)劑 +4 | A_JiXing 2026-03-16 | 4/200 |
|
|
[碩博家園] 湖北工業(yè)大學(xué) 生命科學(xué)與健康學(xué)院-課題組招收2026級食品/生物方向碩士 +3 | 1喜春8 2026-03-17 | 5/250 |
|
|
[考研] 275求調(diào)劑 +4 | 太陽花天天開心 2026-03-16 | 4/200 |
|
|
[考研] 302求調(diào)劑 +4 | 小賈同學(xué)123 2026-03-15 | 8/400 |
|
|
[考研]
|
zhouzhen654 2026-03-16 | 3/150 |
|
|
[考研] 中科院材料273求調(diào)劑 +4 | yzydy 2026-03-15 | 4/200 |
|
|
[考研] 080500,材料學(xué)碩302分求調(diào)劑學(xué)校 +4 | 初識可樂 2026-03-14 | 5/250 |
|