예제 #1
0
        public Dictionary <string, Structure> SetCCL(Bitmap img)
        {
            Bitmap temp = null;
            CCL    ccl  = null;
            Bitmap bmp  = (Bitmap)img.Clone();

            try
            {
                ToolsImages.Structures.Matrix regionMatrix = null;
                SetList regionSets      = null;
                Vector  finalRegionSets = null;


                regionSets = new SetList();

                // temp = (Bitmap)img;
                //  Bitmap bmap = (Bitmap)temp.Clone();

                ccl = new CCL(bmp);

                ccl.DebutLabel();

                ccl.MarqueRegionAller(out regionSets);
                regionMatrix = ccl.MergeRegions(ccl.regionMatrix, regionSets, out finalRegionSets);

                ccl.MiseAJourRegion();

                Dictionary <string, Structure> rr = ccl.PositionRectangle();
                //  bmap.Dispose();

                return(rr);
            }
            catch (Exception err)
            {
                Console.WriteLine(err.Message);
                return(null);
            }
            finally
            {
                ccl.Img.Dispose();
                bmp.Dispose();
                ccl = null;
                //  temp.Dispose();
            }
        }