how to extract image boundary for a color image

5 vues (au cours des 30 derniers jours)
alapati pujitha
alapati pujitha le 16 Mar 2016
Réponse apportée : Gautam le 24 Oct 2024 à 5:12
I need a boundary on white background with boundary black in color

Réponses (1)

Gautam
Gautam le 24 Oct 2024 à 5:12
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");

Community Treasure Hunt

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

Start Hunting!

Translated by