crop_images.m
来自「kmeans clustering in matlab」· M 代码 · 共 20 行
M
20 行
function cropped_images = crop_images(images,x1,x2,y1,y2);
%
% function to take CS 175 data structure of images and to
% crop each image so that the lowerleft corner has
% coordinate [x1,y1] and the upper right corner has coordinate [x2,y2]
[n1 n2] = size(images); % assumes that data structure is a 2d array
cropped_images = images;
for i=1:n1;
for j=1:n2;
oldimage = images(i,j).image;
if size(oldimage,1)>1
cropped_images(i,j).image = oldimage(x1:x2,y1:y2);
end
end
end
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?