image processing canny edge detection
Show older comments
i want to convert image without go to gray scal by split color image by to R G and B after that converting to canny and sum 3 pic
Answers (1)
Walter Roberson
on 31 May 2020
YourImage = imresize(imread('baby.jpg'), 1/8);
R = YourImage(:,:,1);
G = YourImage(:,:,2);
B = YourImage(:,:,3);
ER = edge(R, 'canny');
EG = edge(G, 'canny');
EB = edge(B, 'canny');
anyedge = ER | EG | EB;
alledge = ER & EG & EB;
majorityedge = (ER + EG + EB) >= 2;
Rany = R; Rany(anyedge) = 255;
Gany = G; Gany(anyedge) = 0;
Bany = B; Bany(anyedge) = 0;
RGBany = cat(3, Rany, Gany, Bany);
Rall = R; Rall(alledge) = 255;
Gall = G; Gall(alledge) = 0;
Ball = B; Ball(alledge) = 0;
RGBall = cat(3, Rall, Gall, Ball);
subplot(3,2,1)
imshow(YourImage);
title('Original');
subplot(3,2,2);
imshow(anyedge)
title('Edge found in any plane');
subplot(3,2,3)
imshow(majorityedge)
title('Edge found in 2+ planes');
subplot(3,2,4)
imshow(alledge)
title('Edge found in all planes');
subplot(3,2,5)
imshow(RGBany)
title('Original outlined with any edge');
subplot(3,2,6)
imshow(RGBall)
title('Original outlined with all edge')
Bany = B; Bany(anyedge) = 0;
3 Comments
Mohammad abu aqoulah
on 31 May 2020
Mohammad abu aqoulah
on 1 Jun 2020
Image Analyst
on 1 Jun 2020
Looks like it was answered in your duplicate question: https://www.mathworks.com/matlabcentral/answers/538715-image-processing-edge-edge-detection#comment_877923
Categories
Find more on Object Analysis in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!