예제 #1
0
        private static void MorphOperationShapkaProcess(Bitmap img, MorphOp operation, int[,] structureElement, string elementInf)
        {
            string imgExtension = GetImageInfo.Imginfo(Imageinfo.Extension);
            string imgName      = GetImageInfo.Imginfo(Imageinfo.FileName);
            string defPath      = GetImageInfo.MyPath("Morph");

            string outName = string.Empty;
            Bitmap image   = new Bitmap(img.Width, img.Height, PixelFormat.Format24bppRgb);

            image = MorphOperationProcess(img, operation, structureElement);

            if (string.IsNullOrEmpty(elementInf))
            {
                outName = defPath + imgName + "_" + operation.ToString() + imgExtension;
            }
            else
            {
                outName = defPath + imgName + "_" + operation.ToString() + elementInf + imgExtension;
            }
            Helpers.SaveOptions(image, outName, imgExtension);
        }
예제 #2
0
        private static void MorphOperationArray2FileShapka(int[,] arr, MorphOp operation, int[,] structureElement, string elementInf)
        {
            string defPath = GetImageInfo.MyPath("Morph");
            string outName = string.Empty;

            Bitmap image = new Bitmap(arr.GetLength(1), arr.GetLength(0), PixelFormat.Format24bppRgb);

            int[,] result = new int[arr.GetLength(0), arr.GetLength(1)];

            result = MorphOperationHelper(arr, operation, structureElement);
            image  = Helpers.SetPixels(image, result, result, result);

            if (string.IsNullOrEmpty(elementInf))
            {
                outName = defPath + "_Array2File_" + operation.ToString() + ".png";
            }
            else
            {
                outName = defPath + "_Array2File_" + operation.ToString() + elementInf + ".png";
            }

            image = PixelFormatWorks.Bpp24Gray2Gray8bppBitMap(image);
            Helpers.SaveOptions(image, outName, ".png");
        }