/// <summary> /// Form is being loaded /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void FormMain_Load(object sender, EventArgs e) { // save states new WindowProperties(this); // Refresh contacts first buttonRefreshContacts_Click(sender, e); _FaceVisualiser = new FaceToPictureBox(pictureBoxPreview); toolStripStatusLabelInfo.Text = ""; // update the file list settings bool onlyChanged = (PicFaceConfig.FileView == PicFaceConfig.FileViewSettings.OnlyChanged); allFilesToolStripMenuItem.Checked = !onlyChanged; filesWithChangedFaceInformationToolStripMenuItem.Checked = onlyChanged; #if DEBUG //// ############### _CurrentDirectory = @"D:\Users\Christian.CPC\Pictures\Tests"; textBoxDirectory.Text = _CurrentDirectory; ImageInfoList list = new ImageInfoList(ExifToolPictureData.Collect(_CurrentDirectory)); LoadPictureIndex(); //// ############### #endif }
/// <summary> /// Public constructor, load the list out of a directory /// </summary> /// <param name="directory">Directory</param> public ImageInfoList(string directory) { ExifToolPictureData[] data = ExifToolPictureData.Collect(directory); foreach (ExifToolPictureData d in data) { this.Add(d.SourceFile, new ImageInfo(d)); } }
/// <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); } } }