public void Solve(Bitmap image, Form mainForm) { var forms = new List <Color> { Color.Red, Color.Blue, Color.Green } .Select(color => (filer: new RGBColorMask(color), color)) .Select(tuple => (imageMask: Transformer.GetInstance().Transform(image, tuple.filer), tuple.color)) .Select(tuple => (Form) new Form2(tuple.imageMask) { Text = $@"{tuple.color.Name} mask" }) .ToList(); forms.Add(new Bar_chart(RGBHistogramData.GetInstance(image)) { Text = "RGB histogram" }); forms.ForEach(form => { form.Owner = mainForm; form.Show(); }); }
private void DrawRGBData(RGBHistogramData rgb, Chart redChart, Chart greenChart, Chart blueChart) { redChart.Visible = greenChart.Visible = blueChart.Visible = true; redChart.Series["Red"].Color = Color.Red; greenChart.Series["Green"].Color = Color.Green; blueChart.Series["Blue"].Color = Color.Blue; var maxLength = Math.Max(rgb.RedData.Count, Math.Max(rgb.BlueData.Count, rgb.GreenData.Count)); for (var i = 0; i < maxLength; i++) { redChart.Series["Red"].Points.AddXY(i, rgb.RedData[i]); greenChart.Series["Green"].Points.AddXY(i, rgb.GreenData[i]); blueChart.Series["Blue"].Points.AddXY(i, rgb.BlueData[i]); } }