How to fill a gap in a single width image?
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Dear all, I have an 15X1 logical image for example like this:
0 0 0 1 1 0 0 0 1 1 1 1 0 0 0
As we see, the one's are not connected. I want to make a program that connect the gap between the one's similar the the imfill function in matlab but which can be applied in a single width image. In other words, how to get answer like this 0 0 0 1 1 1 1 1 1 1 1 1 0 0 0
I would appreciate it very much to hear some suggestions.
Meshoo
0 commentaires
Réponse acceptée
Walter Roberson
le 15 Oct 2013
P = find(M, 1, 'first'); %here 1 is number of items to match, not value to match
Q = find(M, 1, 'last');
N = M;
N(P:Q) = 1;
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Image Segmentation and Analysis dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!