www.gusucode.com > images 案例代码 matlab源码程序 > images/CropIndexedImageSpecifyingCropRectangleExample.m

    %% Crop Indexed Image Specifying Crop Rectangle
% 
%% 
% Load indexed image with its associated map into the workspace.

% Copyright 2015 The MathWorks, Inc.

load trees
%%
% Crop indexed image, specifying crop rectangle.
X2 = imcrop(X,map,[30 30 50 75]);
%%
% Display original image and cropped image.
subplot(1,2,1)
imshow(X,map)
title('Original Image')
subplot(1,2,2)
imshow(X2,map)
title('Cropped Image')