demo05 of Im2mesh package
demo05 - Avoid sharp corners
Note
I suggest familiarizing yourself with Im2mesh_GUI before learning Im2mesh package. With graphical user interface, Im2mesh_GUI will help you better understand the workflow and parameters of Im2mesh package.
If you are using Im2mesh package in MATLAB,  you need to install MATLAB Image Processing Toolbox and Mapping Toolbox because Im2mesh package use a few functions in these toolboxes.
Setup
Before we start, please set folder "Im2mesh_Matlab" as your current folder of MATLAB.
Set default image size.
x = 250; y = 250; width = 250; height = 250;
set(groot, 'DefaultFigurePosition', [x,y,width,height])
% set(groot, 'DefaultFigurePosition', 'factory')
Function im2mesh use a mesh generator called MESH2D (developed by Darren Engwirda). We can use the following command to add the folder 'mesh2d-master' to the path of MATLAB.  addpath(genpath('mesh2d-master'))
Circle
Let's start demo. Import image Circle.tif.
im = imread('Circle.tif');
if size(im,3) == 3;  im = rgb2gray( im ); end
imshow( im,'InitialMagnification','fit' );
Generate mesh.
opt.tf_avoid_sharp_corner = false;
opt.thresh_vert_smooth = 20;
opt.thresh_vert_simplify = 20;
[ vert, tria, tnum ] = im2mesh( im, opt );
 Refine triangulation...
 -------------------------------------------------------
      |ITER.|          |CDT1(X)|          |CDT2(X)|     
 -------------------------------------------------------
Warning: Edge constraints have been split by a coincident point.
          4                356                424
         10                388                896
         13                388                940
 Refine triangulation...
 -------------------------------------------------------
      |ITER.|          |CDT1(X)|          |CDT2(X)|     
 -------------------------------------------------------
Warning: Edge constraints have been split by a coincident point.
          7                511                424
         10                531               1808
         20                547               2865
         29                552               2947
 Smooth triangulation...
 -------------------------------------------------------
      |ITER.|          |MOVE(X)|          |DTRI(X)|     
 -------------------------------------------------------
         10                 49               2929
plotMeshes( vert, tria, tnum )
Let's zoom in.
plotMeshes( vert, tria, tnum )
We can see a sharp corner between polygonal boundaries.
In some applications, we don't like these sharp corners.
Avoid sharp corner
We can set parameter tf_avoid_sharp_corner to true. It may help.
opt.tf_avoid_sharp_corner = true;
opt.thresh_vert_smooth = 20;
opt.thresh_vert_simplify = 20;
[ vert, tria, tnum ] = im2mesh( im, opt );
 Refine triangulation...
 -------------------------------------------------------
      |ITER.|          |CDT1(X)|          |CDT2(X)|     
 -------------------------------------------------------
Warning: Edge constraints have been split by a coincident point.
          5                366                440
         10                395                876
         13                395                974
 Refine triangulation...
 -------------------------------------------------------
      |ITER.|          |CDT1(X)|          |CDT2(X)|     
 -------------------------------------------------------
Warning: Edge constraints have been split by a coincident point.
          7                516                440
         10                521               1767
         20                527               2657
         20                527               2657
 Smooth triangulation...
 -------------------------------------------------------
      |ITER.|          |MOVE(X)|          |DTRI(X)|     
 -------------------------------------------------------
         10                 88               2639
plotMeshes( vert, tria, tnum )
Zoom in
plotMeshes( vert, tria, tnum )
Yes, it helps.
set(groot, 'DefaultFigurePosition', 'factory')