예제 #1
0
        //--------------------------------------------------------------------------------------
        private Bitmap CommonSplit(Bitmap pInBitmap)
        {
            byte              lWhat          = (byte)cbClearColor.SelectedIndex;
            CImageSplitter    lImageSplitter = new CImageSplitter();
            FLookSeparatePart form           = new FLookSeparatePart();
            List <byte[][]>   lMatrixList    = lImageSplitter.SplitByMatrix(pInBitmap, lWhat);
            List <Bitmap>     lImages        = CBlackWhiteExplorer.BinaryMatrixListToBitmapList(lMatrixList);

            form.PictureList = lImages;
            for (int i = 0; i < lMatrixList.Count; i++)
            {
                int      lNumber      = i;
                int      lQuantity    = 0;
                int      lQuantityAll = 0;
                int      lCentreX     = 0;
                int      lCentreY     = 0;
                byte[][] lMatrix      = lMatrixList[i];
                for (int n = 0; n < lMatrix.Length; n++)
                {
                    lQuantityAll += lMatrix[n].Length;
                    for (int m = 0; m < lMatrix[n].Length; m++)
                    {
                        if (lMatrix[n][m] == lWhat)
                        {
                            lQuantity++;
                            lCentreX += n;
                            lCentreY += m;
                        }
                    }
                }
                lCentreX /= lQuantityAll;
                lCentreY /= lQuantityAll;
                form.imageListDataSet1.Images.AddImagesRow(lNumber, lQuantity,
                                                           lCentreX, lCentreY, "", 0);
            }
            form.Show();
            int[][] lColorMatrix = CBlackWhiteExplorer.BinaryMatrixListToColorMatrix(lMatrixList, lWhat);
            Bitmap  lColorImage  = CBlackWhiteExplorer.ColorMatrixToColorBitmap(lColorMatrix, lMatrixList.Count);

//            pbAfterCleanColor.Image = lColorImage;
            return(lColorImage);
        }