Example #1
0
 /// <summary>
 /// Specialised constructor
 /// </summary>
 /// <param name="etp">source file where data was read out</param>
 public ExifPictureInfo(ExifToolPictureData etp) : base(etp.SourceFile)
 {
     foreach (RegionMp r in etp.RegionInfoMp.Regions)
     {
         try
         {
             if (r.Rectangle != null)
             { // if only a name but not a rectangle is in xmp, it is null! -> ignore
                 string[] rect = r.Rectangle.Split(new char[] { ',' });
                 float    x, y, w, h;
                 x = Convert.ToSingle(rect[0]);
                 y = Convert.ToSingle(rect[1]);
                 w = Convert.ToSingle(rect[2]);
                 h = Convert.ToSingle(rect[3]);
                 Face f = new Face(r.PersonConvertedName, new RectangleF(x, y, w, h));
                 if (f.Name != null && !f.Name.Equals("ffffffffffffffff") && f.Name.Length > 1)
                 {
                     if (!XmpFaces.ContainsKey(f.Name))
                     {
                         XmpFaces.Add(f.Name, f);
                     }
                 }
             }
         }
         catch
         {
             Debug.WriteLine(etp.SourceFile + " not added to ExifPictureInfo");
         }
     }
 }
Example #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);
            }
             }
        }