예제 #1
0
        //--------------------------------------------------------------------------------------
        /// <summary>
        /// разбить рисунок(представленный как матрица) на отдельные куски
        /// в виде списка рисунков по методу матриц
        /// </summary>
        /// <param name="pMatrix"></param>
        /// <param name="pWhat"></param>
        /// <returns></returns>
        public List <Bitmap> SplitByMatrixToImages(byte[][] pMatrix, byte pWhat)
        {
            List <byte[][]> lMatrixList = SplitByMatrix(pMatrix, pWhat);
            List <Bitmap>   lImages     = CBlackWhiteExplorer.BinaryMatrixListToBitmapList(lMatrixList);

            return(lImages);
        }
예제 #2
0
        //--------------------------------------------------------------------------------------
        /// <summary>
        /// разбить рисунок на отдельные куски
        /// в виде списка рисунков по методу множеств
        /// </summary>
        /// <param name="pImage"></param>
        /// <returns></returns>
        public List <Bitmap> SplitBySetToImages(Bitmap pImage)
        {
            List <byte[][]> lMatrixList = SplitBySet(pImage);
            List <Bitmap>   lImages     = CBlackWhiteExplorer.BinaryMatrixListToBitmapList(lMatrixList);

            return(lImages);
        }
예제 #3
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);
        }