コード例 #1
0
ファイル: ImageProcessor.cs プロジェクト: manjacat/RPS.Photo
 private static Bitmap DrawRectangleToImage(Bitmap img,
                                            List <RectangleModel> rectangles)
 {
     using (Graphics gr = Graphics.FromImage(img))
     {
         foreach (var r in rectangles)
         {
             Rectangle rect1      = ConvertToRectangle(r);
             Bitmap    croppedImg = ImageCropper.CropImage(img, rect1);
             if (r.ObjectType == ObjectTypeEnum.Face)
             {
                 croppedImg = Blur(croppedImg, 6);
                 gr.DrawImage(croppedImg, rect1);
             }
             else if (r.ObjectType == ObjectTypeEnum.Licenseplate)
             {
                 croppedImg = Blur(croppedImg, 8);
                 gr.DrawImage(croppedImg, rect1);
             }
         }
     }
     return(img);
     //img.Save(outputfileName, ImageFormat.Jpeg);
     //Console.WriteLine("OUTPUT file is at " + outputFile);
 }