public List<Bitmap> Apply(Bitmap srcimg)
{
int mw = srcimg.Width;
int mh = srcimg.Height;
int[] pixels = ImageUtils.BitmapToArray1DIntRGB(srcimg);
ColorHistogram colorHist = new ColorHistogram(pixels);
int[] color_array = colorHist.getColorArray();
List<bool[,]> img_list = new List<bool[,]>();
for (int i = 0; i < color_array.Length; i++)
{
img_list.Add(new bool[mh, mw]);
fg_count_list.Add(0);
fg_idx_color_hash.Add(i, color_array[i]);
fg_color_idx_hash.Add(color_array[i], i);
}
for(int i=0;i<mw;i++)
for (int j = 0; j < mh; j++)
{
int idx = (int)fg_color_idx_hash[pixels[j * mw + i]];
(img_list[idx])[j,i] = true;
fg_count_list[idx]++;
}
List<Bitmap> bitmap_list = new List<Bitmap>();
for (int i = 0; i < img_list.Count; i++)
bitmap_list.Add(ImageUtils.ArrayBool2DToBitmap(img_list[i]));
return bitmap_list;
}