image processing edge edge detection
15 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
how can Apply edge detection to the original RGB image using the "Canny edge Operator"
4 Kommentare
Antworten (1)
Image Analyst
am 31 Mai 2020
Did you try edge():
rgbImage = imread('peppers.png');
subplot(1,2,1);
imshow(rgbImage);
grayImage = rgb2gray(rgbImage);
subplot(1,2,2);
edgeImage = edge(grayImage, 'Canny');
imshow(edgeImage, []);
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/306843/image.png)
Or you could do it on each color channel separately if you want.
10 Kommentare
Ameer Hamza
am 1 Jun. 2020
Mohammad, you can try this modified version of Image Analyst's code.
rgbImage = imread('peppers.png');
subplot(2,2,1);
imshow(rgbImage);
[R, G, B] = imsplit(rgbImage);
subplot(2,2,2);
edgeImageR = edge(R, 'Canny');
R(edgeImageR) = 255;
Rimage = zeros(size(rgbImage), 'uint8');
Rimage(:,:,1) = R;
imshow(Rimage, []);
title('Edge Image of Red', 'FontSize', 15)
subplot(2,2,3);
edgeImageG = edge(G, 'Canny');
G(edgeImageR) = 255;
Gimage = zeros(size(rgbImage), 'uint8');
Gimage(:,:,2) = G;
imshow(Gimage, []);
title('Edge Image of Green', 'FontSize', 15)
subplot(2,2,4);
edgeImageB = edge(B, 'Canny');
B(edgeImageR) = 255;
Bimage = zeros(size(rgbImage), 'uint8');
Bimage(:,:,3) = B;
imshow(Bimage, []);
title('Edge Image of Blue', 'FontSize', 15)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/307543/image.png)
Siehe auch
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!