2015-01-18 2 views
2

surf을 실제 크기와 가로 세로 비로 표시하는 방법이 있습니까? 나는 웹에서보고 있었지만 효과가있는 것을 찾을 수 없었다. 나는 또한 MATLAB을 처음 접했습니다.서핑 실제 크기를 표시 하시겠습니까?

rpos1 = 0; % image row vector pos counter 
rpos2 = 0; % existing image vector pos counter 
rpos3 = 0; % avg vector pos counter 
prompt = {'Image location:','Lowest image #:','Highest image #:','Row of interest:','Background noise reduction:'}; 
dlg_title = 'Input'; 
num_lines = 1; 
def = {'C:\Users\Moz\Desktop\Hyperspecdata\images','300','390','700','100'}; 
answer = inputdlg(prompt,dlg_title,num_lines,def); 
directory = (answer{1}); 
x1 = str2num(answer{2}); 
x2 = x1; 
y1 = str2num(answer{3}); 
y2 = y1-1; 
z = str2num(answer{4}); 
v = str2num(answer{5}); 
finalslice = zeros(1,1312); % create matrix (imagecount x 1312) 

%INSERT SLICES WITH 1 GAP% 
for k = x1 : y1 
    baseFileName = sprintf('image0000000%03d.pgm',k); 
    fullFileName = fullfile(directory, baseFileName); %fullfile(folder, baseFileName); 
    A = imread(fullFileName); 
    A = floor(A./16); % transform back to 12 bit 
    B = A-v; % remove background noise 
    rpos1 = rpos1+1; % jump to next row 
    thisline = B(z,:); % desired row in images 
    finalslice(rpos1,:) = thisline; % add row vector 
    rpos1 = rpos1+1; % jump to next row 
    emptyline = zeros(1,1312); % create empty row vector 
    finalslice(rpos1,:) = emptyline; % insert empty row vector 
end 

%INSERT AVERAGES INTO GAPS% 
for k = x2 : y2 
    rpos2 = rpos2+1; % find first existing vector 
    line1 = finalslice(rpos2,:); 
    rpos2 = rpos2+2; % find second existing vector 
    line2 = finalslice(rpos2,:); 
    avgline1 = (line1 + line2)/2; % average both 
    rpos3 = rpos3+2; 
    finalslice(rpos3,:) = avgline1; % insert average vector 
    rpos2 = rpos2-1; % jump back to second existing vector 
end 

figure(1) 
h = surf(finalslice,'EdgeColor','none','LineStyle','none','FaceLighting','phong'); 
colormap('jet'); 
view(2) 

나는 이미지의 무리를로드하고 특정 지점에서 조각을 복용하고 함께 바느질 해요 :

여기 내 코드입니다. 출력물에는 실제 크기와 종횡비가 표시되지 않습니다.

+0

대신지고 무엇 무엇을 당신의 예상 된 결과이고를? – knedlsepp

+0

저는 182x1312 출력을 기대하지만 거리가 길어질 것입니다. 그것의 실제 크기를 보여주지 못한다. 182x1312 표면 그림을보고 싶습니다. – Darellon

+0

Streched one? 실제 크기? '축 평등 '이란 뜻입니까? 또는'axis vis3d'? – knedlsepp

답변

2

해결 :

추가 daspect()

o = max(max(finalslice)); 
[m n] = size(finalslice); 
figure(1) h = surf(finalslice,'EdgeColor','none','LineStyle','none','FaceLighting','phong'); colormap('jet'); 
view(2) 
daspect([m n o]); 
관련 문제