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 view (last 30 days)
Show older comments
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
0 Comments
Answers (1)
DGM
on 12 Mar 2023
The output of edge() is already a binary image (class 'logical'). There's no need to use imbinarize() on it.
0 Comments
See Also
Categories
Find more on Modify Image Colors in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!