How to do edge detection on a jpg file?
6 views (last 30 days)
Show older comments
I = imread('E.jpg');
imshow(I)
BW1 = edge(I,'prewitt');
BW2 = edge(I,'canny');
figure;
imshow(BW1)
figure;
imshow(BW2)
BW1 = edge(I,'prewitt'); - This shows error that I needs to be 2 - dimensional but I is already 2 - D I assume.
0 Comments
Answers (1)
Image Analyst
on 6 Feb 2015
It's probably color (3D). Convert to grayscale:
grayImage = rgb2gray(rgbImage);
Or, in hsv space
hsv= rgb2hsv(rgbImage);
hueImage = hsv(:,:,1); % Now do edge() on hueImage
Or, extract one of the color channels:
% Extract the individual red, green, and blue color channels.
redChannel = rgbImage(:, :, 1);
greenChannel = rgbImage(:, :, 2);
blueChannel = rgbImage(:, :, 3);
0 Comments
See Also
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!