public KMeans(Bitmap bmp, int numCluster, Colour.Types model) { _image = (Bitmap)bmp.Clone(); _processedImage = (Bitmap)bmp.Clone(); _model = model; _previousCluster = new Dictionary<string, Cluster>(); _currentCluster = new Dictionary<string, Cluster>(); FindTopXColours(numCluster); //find top X colours in the image //create clusters for top X colours for (int i = 0; i < _topColours.Length; i++) { PixelData pd = Colour.GetPixelData(_topColours[i].R, _topColours[i].G, _topColours[i].B, model); _previousCluster.Add(_topColours[i].Name, new Cluster(pd.Ch1, pd.Ch2, pd.Ch3)); _currentCluster.Add(_topColours[i].Name, new Cluster(pd.Ch1, pd.Ch2, pd.Ch3)); } }
public KMeans(Bitmap bmp, int numCluster, Colour.Types model) { _image = (Bitmap)bmp.Clone(); _processedImage = (Bitmap)bmp.Clone(); _model = model; _previousCluster = new Dictionary <string, Cluster>(); _currentCluster = new Dictionary <string, Cluster>(); FindTopXColours(numCluster); //find top X colours in the image //create clusters for top X colours for (int i = 0; i < _topColours.Length; i++) { PixelData pd = Colour.GetPixelData(_topColours[i].R, _topColours[i].G, _topColours[i].B, model); _previousCluster.Add(_topColours[i].Name, new Cluster(pd.Ch1, pd.Ch2, pd.Ch3)); _currentCluster.Add(_topColours[i].Name, new Cluster(pd.Ch1, pd.Ch2, pd.Ch3)); } }