ArcStrabo10.ArcStraboObject.fillImageList C# (CSharp) Метод

fillImageList() приватный Метод

private fillImageList ( string path, List imgList, Byte>.Image srcImage ) : void
path string
imgList List
srcImage Byte>.Image
Результат void
        private void fillImageList(string path, List<Bitmap> imgList, Image<Bgr, Byte> srcImage)
        {
            FeatureInJSON _featureInJSON;
            GeoJson geoJson = new GeoJson();

            try
            {
                if (!File.Exists(path))
                    return;
                _featureInJSON = geoJson.readGeoJsonFile(path);

                for (int j = 0; j < _featureInJSON.features.Count; j++)
                {
                    double x1, x2, y1, y2;
                    x1 = _featureInJSON.features[j].geometry.rings[0, 0, 0];
                    y1 = _featureInJSON.features[j].geometry.rings[0, 0, 1];
                    x2 = _featureInJSON.features[j].geometry.rings[0, 1, 0];
                    y2 = _featureInJSON.features[j].geometry.rings[0, 2, 1];

                    Rectangle rec = new Rectangle(int.Parse(Math.Round(x1).ToString()), int.Parse((Math.Round(y1 * -1)).ToString()), int.Parse(Math.Round((x2 - x1)).ToString()),
                        int.Parse(Math.Round((y1 - y2)).ToString()));
                   // Image<Bgr, Byte> test =  srcImage.GetSubRect(rec);
                    Bitmap img = srcImage.Bitmap;

                    if (rec.X < 0 || rec.X > srcImage.Width || rec.Y < 0 || rec.Y > srcImage.Height)
                    {
                        System.Windows.Forms.MessageBox.Show("Text recognition labels are out of bound! please check and put them within Image");
                        return;
                    }

                    Bitmap cropedImage = img.Clone(rec, img.PixelFormat);
                    cropedImage.Save(CreateDirectory(path, "Data") + "\\img" + j.ToString());
                    imgList.Add(cropedImage);
                }
            }
            catch (Exception e)
            {
                Log.WriteLine("fillImageList: " + e.Message);
            }
        }