Azzera filtri
Azzera filtri

How to remove inner edge of the target?

4 visualizzazioni (ultimi 30 giorni)
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.

Risposta accettata

Matt J
Matt J il 12 Ago 2023
Modificato: Matt J il 12 Ago 2023
load('Edge_logical.mat')
imshow( edge(imfill(Edge_S1,'holes')) ,[])
  1 Commento
Amjad Iqbal
Amjad Iqbal il 12 Ago 2023
Thank you so much for your prompt response and its helpful for me.

Accedi per commentare.

Più risposte (1)

Image Analyst
Image Analyst il 12 Ago 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 Commenti
Amjad Iqbal
Amjad Iqbal il 13 Ago 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 il 13 Ago 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.

Accedi per commentare.

Prodotti


Release

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by