如何在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