Esempio n. 1
0
        private bool GenerateSpriteSignatures(ref ClientItems items)
        {
            if (items.SignatureCalculated)
            {
                return true;
            }

            ProgressForm progress = new ProgressForm();
            progress.StartPosition = FormStartPosition.Manual;
            progress.Location = new Point(Location.X + ((Width - progress.Width) / 2), Location.Y + ((Height - progress.Height) / 2));
            progress.bar.Minimum = 0;
            progress.bar.Maximum = items.Count;
            progress.Show(this);
            progress.progressLbl.Text = "Calculating image signatures...";

            foreach (ClientItem clientItem in items.Values)
            {
                clientItem.GenerateSignature();

                if (progress.bar.Value % 20 == 0)
                {
                    Application.DoEvents();
                }

                progress.bar.Value++;
            }

            items.SignatureCalculated = true;
            progress.Close();
            return true;
        }
Esempio n. 2
0
		private bool GenerateSpriteSignatures(ref ClientItems items)
		{
			if (items.signatureCalculated)
			{
				return true;
			}

			ProgressForm progress = new ProgressForm();
			progress.StartPosition = FormStartPosition.Manual;
			progress.Location = new Point(Location.X + ((Width - progress.Width) / 2),
										  Location.Y + ((Height - progress.Height) / 2));
			progress.bar.Minimum = 0;
			progress.bar.Maximum = items.Count;
			progress.Show(this);

			foreach (ClientItem clientItem in items.Values)
			{
				Bitmap spriteBmp = GetBitmap(clientItem);
				Bitmap ff2dBmp = Fourier.fft2dRGB(spriteBmp, false);
				clientItem.SpriteSignature = ImageUtils.CalculateEuclideanDistance(ff2dBmp, 1);

				if (progress.bar.Value % 20 == 0)
				{
					Application.DoEvents();
				}
				progress.progressLbl.Text = String.Format("Calculating image signature for item {0}.", clientItem.id);
				++progress.bar.Value;
			}

			items.signatureCalculated = true;
			progress.Close();
			return true;
		}