Пример #1
0
        private Image GetBoxImage(Bitmap img, PredictionBoundingBox box)
        {
            var rec    = GetBoxFromImage(box, img.Size);
            var format = img.PixelFormat;
            var newImg = img.Clone(rec, format);

            newImg.Save(@"C:\Users\ch489gt\Pictures\Snag-Auto\marin.png");
            return(newImg);
        }
Пример #2
0
 private Rectangle GetBoxFromImage(PredictionBoundingBox box, Size imgSize)
 {
     return(new Rectangle()
     {
         X = Convert.ToInt32(imgSize.Width * box.Left),
         Y = Convert.ToInt32(imgSize.Height * box.Top),
         Width = Convert.ToInt32(imgSize.Width * box.Width),
         Height = Convert.ToInt32(imgSize.Height * box.Height)
     });
 }
Пример #3
0
 private Image GetBoxImage(string imageFileName, PredictionBoundingBox box)
 {
     return(GetBoxImage(new Bitmap(imageFileName), box));
 }