Create a binary edge image of Malards.jpg using only the red channel of the image. Obtain the binary image with all edges that are stronger than 50 using Roberts edge detecti

1 次查看(过去 30 天)
tried to create a binary edge image using only red channel of the image but when i was running the code i was receiving the error
Error using imbinarize
Expected I to be one of these types:
uint8, uint16, uint32, int8, int16, int32, single, double
Instead its type was logical.
Error in imbinarize>validateImage (line 262)
validateattributes(I,supportedClasses,supportedAttribs,mfilename,'I');
Error in imbinarize>parseInputs (line 198)
validateImage(I);
Error in imbinarize (line 134)
[I,isNumericThreshold,options] = parseInputs(I,varargin{:});
Error in untitled1 (line 5)
binaryImg = imbinarize(edgeImg);
CODE:
img = imread('Malards.jpg');
redChannel = imsplit(img);
redChannel = redChannel(:,:,1);
edgeImg = edge(redChannel, 'Roberts', 50);
binaryImg = imbinarize(edgeImg);
imshow(binaryImg);
any suggestions and help please

回答(1 个)

DGM
DGM 2023-3-12
The output of edge() is already a binary image (class 'logical'). There's no need to use imbinarize() on it.

类别

Help CenterFile Exchange 中查找有关 Modify Image Colors 的更多信息

标签

产品


版本

R2021a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by