Effacer les filtres
Effacer les filtres

How to remove inner edge of the target?

4 vues (au cours des 30 derniers jours)
Amjad Iqbal
Amjad Iqbal le 12 Août 2023
Commenté : Image Analyst le 13 Août 2023
Hello dear MATLAB Experts,
I have attached an image of a target. When I apply the "edge" function to this target, I obtain both inner and outer edges. However, the actual edges of my target, in terms of size, correspond to the outer ones. How can I remove the inner edges?
".mat" file is attached data for binary image and edge image.
I am grateful for your kind guidance.

Réponse acceptée

Matt J
Matt J le 12 Août 2023
Modifié(e) : Matt J le 12 Août 2023
load('Edge_logical.mat')
imshow( edge(imfill(Edge_S1,'holes')) ,[])
  1 commentaire
Amjad Iqbal
Amjad Iqbal le 12 Août 2023
Thank you so much for your prompt response and its helpful for me.

Connectez-vous pour commenter.

Plus de réponses (1)

Image Analyst
Image Analyst le 12 Août 2023
What do you want to do? Why did you use edge() instead of simply thresholding?
Anyway, if you want a list of outer boundary coordinates, you can use bwboundaries
boundaries = bwboundaries(binaryImage, 'noholes');
If you want an image of the outer perimeter, you can use imfill and bwperim
filledMask = imfill(binaryImage, 'holes');
perimeterImage = bwperim(filledMask);
This looks like an XY problem https://en.wikipedia.org/wiki/XY_problem so your suggested approach might not be the optimal one, but we don't know because you didn't share the use case or context. Happy to hear more if you want better advice.
  2 commentaires
Amjad Iqbal
Amjad Iqbal le 13 Août 2023
Thank you so much for providing the solution. The context of the query is to determine the actual size after applying compressive sensing to inverse SAR imaging (CS-ISAR). The objective is to quantitatively validate the sizes at different sparsity levels through overlapping. In this case, 50% of the data was used to reconstruct the image using our CS model.
I applied "thresholding" to the first image to isolate the target, resulting in the gray image in the middle. Then, I utilized the "edge" detection technique to identify the size from all sides.
The size of the outer edge was more relevant to the target. Once again, I truly appreciate the detailed guidelines you provided.
Image Analyst
Image Analyst le 13 Août 2023
Yeah, like I thought. You really didn't need to do an edge detection like you thought. If you want the area of the non-filled blob, you can do
props = regionprops(mask, 'Area');
donutArea = [props.Area]; % Area(s) of each blob in the image.
or you can do
donutArea = bwarea(mask); % Area of all blobs in image.
If you want the outer perimeter length you can get it from using regionprops on the filled mask:
props = regionprops(filledMask, 'Area', 'Perimeter');
perimeters = [props.Perimeter]; % Perimeter(s) of each blob in the image.
The problem with doing edge detection is that sometimes you get two edges (an inner one and an outer one) and sometimes they may not overlap the actual perimeter.

Connectez-vous pour commenter.

Produits


Version

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by