【发布时间】:2014-10-20 05:54:57
【问题描述】:
我在 MATLAB 中裁剪图像时遇到问题。代码如下:
n = 128;
% M0 = rescale(imcrop(x_gray,n));
[xx, xy] = size(x_gray);
M0 = rescale(imcrop(x_gray, 1, 1, n, n));
x_gray 的大小为 384x512:
>> size(x_gray)
ans =
384 512
imcrop() 给出以下错误:
Attempted to access spatial_rect(4); index out
of bounds because numel(spatial_rect)=1.
Error in imcrop (line 128)
pixelHeight = spatial_rect(4) *
pixelsPerVerticalUnit;
为什么索引超出范围? imcrop 的语法是:
B = imcrop(A,[xmin ymin width height]);
【问题讨论】:
标签: image matlab image-processing crop