2017-05-06 341 views

回答

0

最簡單的方法就是通過比例因子乘以(或除以找到以前的座標):

% read image and generate several coordinates to plot on 
im = imread('lena.jpg'); 
[x,y] = meshgrid(100:100:450); 
x = x(:); y = y(:); 
% scale of resizing 
scale = 0.4; 
% plot original image 
subplot(131); 
imshow(im); 
hold on; 
plot(x,y,'xr','LineWidth',2,'MarkerSize',15); 
title(sprintf('Original, size = [%d,%d]',size(im,1),size(im,2))); 
% resize to obtain smaller image 
imSmall = imresize(im,scale); 
subplot(132); 
imshow(imSmall); 
hold on; 
% plot scaled coordinates 
plot(x.*scale,y.*scale,'xr','LineWidth',2,'MarkerSize',15); 
title(sprintf('Small, size = [%d,%d]',size(imSmall,1),size(imSmall,2))); 
% resize to obtain larger image 
imBig = imresize(im,1/scale); 
subplot(133); 
imshow(imBig); 
hold on; 
% plot scaled coordinates 
plot(x./scale,y./scale,'xr','LineWidth',2,'MarkerSize',15); 
title(sprintf('Big, size = [%d,%d]',size(imBig,1),size(imBig,2))); 

enter image description here