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;
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);
}
}