image processing edge edge detection
이전 댓글 표시
how can Apply edge detection to the original RGB image using the "Canny edge Operator"
댓글 수: 4
Ameer Hamza
2020년 5월 31일
편집: Ameer Hamza
2020년 5월 31일
What do you mean by "detection to the original RGB image"? Do you want to convert it without converting to grayscale?
Mohammad abu aqoulah
2020년 5월 31일
Mohammad abu aqoulah
2020년 6월 1일
Mohammad abu aqoulah
2020년 6월 1일
답변 (1개)
Image Analyst
2020년 5월 31일
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, []);

Or you could do it on each color channel separately if you want.
댓글 수: 10
Mohammad abu aqoulah
2020년 5월 31일
Mohammad abu aqoulah
2020년 6월 1일
Image Analyst
2020년 6월 1일
Yes, you can. Just use imsplit()
[R, G, B] = imsplit(RGB);
Then do the obvious things. You did not ask a question but I assume you want to know how, rather than jsut telling me what you want.
rgbImage = imread('peppers.png');
subplot(2,2,1);
imshow(rgbImage);
[R, G, B] = imsplit(RGB);
subplot(2,2,2);
edgeImageR = edge(R, 'Canny');
imshow(edgeImageR, []);
title('Edge Image of Red', 'FontSize', 15)
subplot(2,2,3);
edgeImageG = edge(G, 'Canny');
imshow(edgeImageG, []);
title('Edge Image of Green', 'FontSize', 15)
subplot(2,2,4);
edgeImageB = edge(B, 'Canny');
imshow(edgeImageB, []);
title('Edge Image of Blue', 'FontSize', 15)
Mohammad abu aqoulah
2020년 6월 1일
Image Analyst
2020년 6월 1일
Then you should be happy with my solution and click "Accept this answer" because that's what it does, except for the addition part but that's super trivial.
theSum = double(g_d) + double(b_d) + double(r_d);
Mohammad abu aqoulah
2020년 6월 1일
Image Analyst
2020년 6월 1일
What are you expecting? Each color channel is a gray scale, monochrome image. If you take just one color channel, like the red channel, why do you think it should not be grayscale? Do you think it should have full, true color? With green and blue also? Of course not. You extracted only the red so there will be no green or blue pixels. There can be no color info at all, just a monochrome image with one value per pixel - the intensity of the red signal at that pixel. Please explain why you think there should still be color, or else explain what "my problem" is when you say "image show with gray scale this is my problem" because I do not see that as a problem because you said you "want firstly split this image into R , G and B". Why did you want to split the color image into 3 monochrome matrices (one per color channel) if it's going to be a problem? What would NOT be a problem for you?
Mohammad abu aqoulah
2020년 6월 1일
Ameer Hamza
2020년 6월 1일
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)

카테고리
도움말 센터 및 File Exchange에서 Object Analysis에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
