![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1798270/image.png)
how to extract image boundary for a color image
1 回表示 (過去 30 日間)
古いコメントを表示
I need a boundary on white background with boundary black in color
0 件のコメント
回答 (1 件)
Gautam
2024 年 10 月 24 日
You can use the "edge" function with the "Canny" detect edges in the image
Please refer to the code below
% Read the color image
img = imread('peppers.png');
% Convert the image to grayscale
grayImg = rgb2gray(img);
% Detect edges using the Canny edge detector
edges = edge(grayImg, 'Canny');
subplot(1,2,1)
imshow(img)
title("Original Image");
subplot(1,2,2)
imshow(edges)
title("Detected Edges");
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1798270/image.png)
0 件のコメント
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!