我是MATLAB的新手,也是图像处理的新手。
我要找到图像的轮廓,所以
leaf = imread('images\leaf.jpg')
SE = [1 1 1
1 1 1
1 1 1]
figure
imshow(leaf)
title("leaf_origin")
erosed_leaf = imerode(leaf,SE);
Contour = double(leaf) - double(erosed_leaf)
Contour=~Contour
figure
imshow(Contour)
运行imshow
时出现错误
使用images.internal.imageDisplayValidateParams> validateCData时出错(第119行)如果输入是逻辑(二进制),则它必须是二维的。
images.internal.imageDisplayValidateParams(第27行)中的错误common_args.CData = validateCData(common_args.CData,image_type);
images.internal.imageDisplayParseInputs(第78行)中的错误common_args = images.internal.imageDisplayValidateParams(common_args);
imshow中的错误(第241行)images.internal.imageDisplayParseInputs({'Parent','Border','Reduce'},preparsed_varargin {:});
如果我在~
前删除contour
,它可以工作,但输出不正确。任何人都可以给我任何关于错误的提示吗?
erosed_leaf = imerode(leaf,SE);
contour = double(leaf) - double(erosed_leaf);
contour = double(~contour);
figure();
imshow(contour);