Seperating labeled array areas using contourf
Afficher commentaires plus anciens
I want to seperate areas which are stored in a labeled array. My intention was to use contourf as the built-in interpolation prevents sharp edges. As seen in the following picture, this is what I do not wan't to achieve (just as an example, contourf is not doing that!):

When I use
[M, c] = contourf(image_array, 200)
then 200 areas are succesfully distinguished. I know before how many areas there will be. However the above code results in a strange behaviour as lines are not only surrounding the labeled area, but instead other areas as well. The next picture is illustratin what I'm talking about:

As seen at most boundaries more than one line is seperating the areas.
My two questions are:
- How can I prevent contourf from using multiple lines around an area? What I want is just a single line as in the top right or bottom middle part of the picture.
- Any ideas how I can export the resulting seperation lines to mesh the areas e. g. with gmsh?
I attatched a file showing a cropped part of my areas.
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Agriculture dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!










