public static List <Cellule> Start(DraftSight.Interop.dsAutomation.ReferenceImage img, List <PointF> liste, int nbEquilibrage, out VoronoiGraph graph) { List <Cellule> listepoincon = null; try { int LgMM = (int)img.Width; int HtMM = (int)img.Height; int LgPx = LgMM + 1; int HtPx = HtMM + 1; var bmp = new Bitmap(img.GetPath()); Settings.Bmp = bmp.Redimensionner(new Size(LgPx, HtPx)); bmp.Dispose(); Settings.Dimensions = new Size(LgMM, HtMM);; //Settings.Histogram = BitmapHelper.Histogramme(Settings.Bmp); BitmapHelper.Verrouiller(Settings.Bmp); Settings.Graph = VoronoiGraph.ComputeVoronoiGraph(liste, LgMM, HtMM, false); for (int k = 0; k < nbEquilibrage; k++) { liste = Equilibrer(); Settings.Graph = VoronoiGraph.ComputeVoronoiGraph(liste, LgMM, HtMM, false); } listepoincon = CalculerCellule(); BitmapHelper.Liberer(); Settings.Bmp.Dispose(); } catch (Exception ex) { LogDebugging.Log.Message(ex); } graph = Settings.Graph; return(listepoincon); }