Trace a ROI and remove it from image
Afficher commentaires plus anciens
Hi All
I have the following image . I want to trace the part which is shown in red lines and remove it from the image . but I don't know how I can scan from top to bottom to find the object and remove it. can anyone help me to do this ???
Thanks in advance for helping me
Here is the image attached

here is another image

Réponses (1)
Image Analyst
le 22 Juil 2018
0 votes
See my attached masking demo. It will do that.
6 commentaires
Image Analyst
le 22 Juil 2018
Since you know the location (columns) of the red lines that you drew, you can simply do
binaryImage(:, column1 : column2) = false;
Alina tom
le 22 Juil 2018
Image Analyst
le 22 Juil 2018
So I'm guessing (since you haven't explained it) that you want to eliminate little blobs attached to the main large blobs with smoothly varying tops. Is that right?
If so, what I'd do is to fit the top rows to a very smooth line with conv() using a very large window. Then I'd compute the absolute different of that curve to the actual curve. Any that are above some threshold distance, I'd toss out (like set to nan or zero or something). Easy - give it a try
windowWidth = 101;
kernel = ones(1, windowWidth);
smoothedTopRows = conv(topRows, kernel, 'same');
diffs = topRows - smoothedTopRows;
badColumns = diffs > 5; % or whatever.
topRows(badColumns) = nan;
That's untested so adapt it if it's not working.
Alina tom
le 23 Juil 2018
Image Analyst
le 23 Juil 2018
ALL your blobs have dark regions below them.
You can use bwareafilt() if you want to toss out small blobs.
Catégories
En savoir plus sur Image Category Classification 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!