How can I make edges black and background white in an photo with detected edges?
Afficher commentaires plus anciens
Hey, everyone! I'm studying on edge detection at MATLAB and have a sample code for that.The edges are white and the background is black.However, my teacher wants to see that edges are black and the background is white.How can I do that? .Also, edge should be only between land and sea.The edges inside land should not be shown (my code doesn't show them anyways).'erodedimg = 255 - real(erodedimg)' part does the image all white even tho I made the white edges bigger with imdilate function.
Image is attached.
The code:
clc;
I = imread('island.bmp');
BW1 = edge(I,'Prewitt',0.18);
se = strel('square',3);
erodedimg = imdilate(BW1,se);
erodedimg = 255 - real(erodedimg);
imshow(erodedimg);
Please help me about that. Thanks by now for your attention.
4 commentaires
Eleanor Betton
le 26 Fév 2020
do you need to be using the edge function? could you use a differnt method of edge detection? You could achive this with thresholding I believe.
Ayberk Ay
le 26 Fév 2020
Eleanor Betton
le 26 Fév 2020
By thresholding you can see the sea is mainly has a value less than 80, if you set all picels with less than 80 to be while and anything higher as island you get a rough island shape - it is pretty rough so you probably want to keep trying edge detection.
Eleanor Betton
le 26 Fév 2020
This gives a similar examples which might help.
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Object Analysis dans Centre d'aide et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
