如何在matlab GUI上調整我的座標軸大小以適應剛剛調整大小的圖像大小?調整軸的大小以適合圖像
我有這樣的:
I = imread('honolulu.png');
I = imresize(im2double(I), [600, 700]);
我畫上的圖片網格之後,但由於軸大小不同的網格不好看。但是,如果我創建一個圖形,然後在GUI外面的圖形上完成它,它看起來很完美。 全碼:
%Load map
I = imread('honolulu.png');
%Resize image to be multiple of 50 in each axis.
I = imresize(im2double(I), [600, 700]);
%Draw grid of 50x50 pixels.
I(50:50:end, :, :) = 255;
I(:, 50:50:end, :) = 255;
axes(handles.axes1);
h = handles.axes1;imshow(I);
while (ishandle(h))
try
[x, y] = ginput(1);
catch me
%break loop in case image is closed.
break;
end
%Compute top left coordinate of block clicked.
x0 = floor((x-1)/50)*50;
y0 = floor((y-1)/50)*50;
%Set block RGB to random color.
I(y0+1:y0+50-1, x0+1:x0+50-1, 1) = rand();
I(y0+1:y0+50-1, x0+1:x0+50-1, 2) = rand();
I(y0+1:y0+50-1, x0+1:x0+50-1, 3) = rand();
imshow(I);
end
% Choose default command line output for city_planning
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
它的外觀VS它應該是怎樣看
你能更具體嗎?你如何繪製網格?示例圖像會很有幫助。 – ConfusinglyCuriousTheThird
@ConfusinglyCuriousTheThird更新 – carlosremove