[Gmsh] Binary image meshing
Sathyanarayan Rao
sathyanarayan.rao at uclouvain.be
Mon Feb 26 16:58:20 CET 2018
Hello gmsh team,
I was thinking of elegant way to mesh an binary image ( black and white). Is there simple way to define black and white regions as separate physical surfaces
in gmsh and automatically assign mesh size field ( finer for white , coarser for black ) ? I saw one example where one of the author of gmsh meshes his own
image and it is very interesting to see this but in his code, is there a way to mark different regions of color with physical marker, for example all dark regions
where finer mesh occurs as one physical marker based on pixel value of image ?
http://www.montefiore.ulg.ac.be/~geuzaine/
// Merge the image (this will create a new post-processing view,
// View[0])
Merge "cg.jpg";
// Modify the normalized pixel values to make them reasonnable
// characteristic lengths for the mesh
Plugin(ModifyComponents).Expression0 = "v0 * 10";
Plugin(ModifyComponents).Run;
// Apply the view as the current background mesh
Background Mesh View[0];
// Build a simple geometry on top of the background mesh
w = View[0].MaxX;
h = View[0].MaxY;
Point(1)={0,0,0,w};
Point(2)={w,0,0,w};
Point(3)={w,h,0,w};
Point(4)={0,h,0,w};
Line(1) = {1,2};
Line(2) = {2,3};
Line(3) = {3,4};
Line(4) = {4,1};
Line Loop(5) = {3,4,1,2};
Plane Surface(6) = {5};
________________________________
Best Regards,
Sathyanarayan Rao, PhD student
Earth and Life Institute/Environmental Sciences (ELI-e)
Université catholique de Louvain
c.037, Croix du Sud 2, Louvain-la-Neuve, Belgium
Phone: 010473827 ( intercom 73827)
________________________________
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://onelab.info/pipermail/gmsh/attachments/20180226/f145d87f/attachment.html>
More information about the gmsh
mailing list