-2
在运行这段代码我得到一个错误说:错误而执行圆形作物
指数超过矩阵尺寸。
错误在作物(第8行)
croppedImage(:,:,2)= I(:,:,2)。*掩模;
I = imread('cameraman.tif');
imageSize = size(I);
ci = [100,100,20]; % center and radius of circle ([c_row, c_col, r])
[xx,yy] = ndgrid((1:imageSize(1))-ci(1),(1:imageSize(2))-ci(2));
mask = uint8((xx.^2 + yy.^2)<ci(3)^2);
croppedImage = uint8(zeros(size(I)));
croppedImage(:,:,1)=I(:,:,1).*mask;
croppedImage(:,:,2)=I(:,:,2).*mask;
croppedImage(:,:,3)=I(:,:,3).*mask;
imshow(croppedImage);
请帮助,我无法调试这个错误。
看起来不像C代码? – acraig5075
matlab,可能吗? –
因为.....它不是RGB图像,而是灰度图像?..... –