/// <summary> /// Resets ColourInfo.Frequency fields to the number of times that colour appears in the image. /// If Image has N pixels, and ColourMap has M colours, total time = M + Nlog(M) ~= N /// </summary> public void UpdateColourMapFrequency() { if (mOutput == null || ColourMap == null) { return; } ColourMap.ClearFrequencies(); // M Bitmap b = mOutput; for (int x = 0; x < b.Width; x++) // this loop iterates N times { for (int y = 0; y < b.Height; y++) { Color c = b.GetPixel(x, y); ColourMap.Colours[c].Frequency++; // Dictionary access is log(M)? } } }