Beispiel #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);
        }
Beispiel #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)
     });
 }
Beispiel #3
0
 private Image GetBoxImage(string imageFileName, PredictionBoundingBox box)
 {
     return(GetBoxImage(new Bitmap(imageFileName), box));
 }