image processing canny edge detection

回答(1 个)

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 个评论

i want to convert RGB image to R , G and B
after that convert R to canny edge
after that convert G to canny edge
after that convert B to canny edge
after that sum three pic
i mean
i have image i want firstly split this image into R , G and B and show 3 images red , green and blue images
secondly apply edge canny in each 3 colore image
canny edge detection on green image (g_d)
canny edge detection on blue image (b_d)
canny edge detection on red image (r_d)
after that add (g_d)+(b_d)+(r_d) to have colore canny detection

请先登录,再进行评论。

类别

帮助中心File Exchange 中查找有关 Convert Image Type 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by