Beispiel #1
0
        /// <summary>
        /// Draw the face
        /// </summary>
        /// <param name="face">face to draw</param>
        public void DrawFace(Face face)
        {
            _Graphics = Graphics.FromImage(_Image);
             int x = (int)(face.Rect.X * _Image.Width);
             int w = (int)(face.Rect.Width * _Image.Width);
             int y = (int)(face.Rect.Y * _Image.Height);
             int h = (int)(face.Rect.Height * _Image.Height);

             _Graphics.DrawRectangle(_RectanglePen, x,y,w,h);
             _PictureBox.Refresh();
        }
Beispiel #2
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="data">The exiftool data which is needed to build this object</param>
        internal ImageInfo(ExifToolPictureData data)
        {
            _ExifToolPictureData = data;

             // Create the face list with all XMP faces
             _XmpFaces = new FaceList();
             if (data.RegionInfoMp != null && data.RegionInfoMp.Regions != null)
             {
            foreach (RegionMp region in data.RegionInfoMp.Regions)
            {
               string[] rect = region.Rectangle.Split(new char[] { ',' });
               float x, y, w, h;
               x = (float)Math.Round(Convert.ToSingle(rect[0]), Precision);
               y = (float)Math.Round(Convert.ToSingle(rect[1]), Precision);
               w = (float)Math.Round(Convert.ToSingle(rect[2]), Precision);
               h = (float)Math.Round(Convert.ToSingle(rect[3]), Precision);
               Face f = new Face(region.PersonConvertedName, new RectangleF(x, y, w, h));
               _XmpFaces.Add(f);
            }
             }

             // Create the face list with all Picasa faces
             _PicasaFaces = new FaceList();
             if (data.RegionInfo.RegionList != null)
             {
            foreach (ExifTool.Region region in data.RegionInfo.RegionList)
            {

               float x, y, w, h;

               x = (float)Math.Round(region.Area.X - (region.Area.W / 2), Precision);
               y = (float)Math.Round(region.Area.Y - (region.Area.H / 2), Precision);
               w = (float)Math.Round(region.Area.W, Precision);
               h = (float)Math.Round(region.Area.H, Precision);
               Face f = new Face(region.PersonConvertedName, new RectangleF(x, y, w, h));
               _PicasaFaces.Add(f);
            }
             }
        }