Esempio n. 1
0
 private void btnDupes_Click(object sender, EventArgs e)
 {
     try
     {
         splitContainer.Panel1Collapsed = false;
         grdDupes.Visible = true;
         _Results         = _IR.FindDuplicates();
         GridLoadDupes(_Results, grdDupes);
         grdResult.Rows.Clear();
         splitContainer.Visible = true;
     }
     catch (Exception ex)
     {
         Utils.HandleException(ex);
     }
 }
Esempio n. 2
0
File: IR.cs Progetto: codeybear/IR
        /// <summary> Find duplicates within the currectly loaded images </summary>
        public DupesList FindDuplicates()
        {
            DupesList Dupes = new DupesList();

            Dictionary <string, string> ResultCheck = new Dictionary <string, string>();

            DateTime dt = DateTime.Now;

            foreach (string sKey in _ImageList.Keys)
            {
                ImageInfo ThisImage = _ImageList[sKey];

                // If this image has already been found as a match then don't search for it
                // This prevents unnecessary duplicates, i.e. where image A matches B, also B matches A
                if (ResultCheck.ContainsKey(ThisImage.File))
                {
                    continue;
                }

                List <Result> Results = Search(ThisImage, 0, 130);

                // Search results will always contain 1 result as the search image will be found in the results
                if (Results.Count > 1)
                {
                    //Bitmap bmp = ImageHelper.ImageUtil.CreateBitmapFromArray(ThisImage.SmallImage, SmallBitmapData);
                    Dupes.Add(new Dupes {
                        File = ThisImage.File, ResultList = Results, smallImage = null
                    });

                    foreach (Result result in Results)
                    {
                        if (!ResultCheck.ContainsKey(result.File))
                        {
                            ResultCheck.Add(result.File, "");
                        }
                    }
                }
            }

            TimeSpan duration = DateTime.Now - dt;

            Console.WriteLine("ImageSearch.IR.FindDuplicates Duration: " + duration.ToString());

            return(Dupes);
        }