public MosaicForm() { InitializeComponent(); uniformSampler = new UniformImageSampler() { Progress = samplingProgress }; gaussianSampler = new GaussianImageSampler() { Progress = samplingProgress }; hybridGaussianSampler = new HybridGaussianImageSampler() { Progress = samplingProgress, ClusterCount = 10 }; voronoiVisualizer = new VoronoiVisualizer(reconstructionProgress); pointVisualizer = new PointVisualizer(reconstructionProgress); visualizer = voronoiVisualizer; imageSampler = uniformSampler; SetVoronoiVisualizerOptions(); this.samplerTypeComboBox.DataSource = System.Enum.GetValues(typeof(ImageSamplerType)); this.imageVisualizerComboBox.DataSource = System.Enum.GetValues(typeof(VisualizerType)); samplerTypeComboBox.SelectedIndex = 0; imageVisualizerComboBox.SelectedIndex = 0; samplingProgress.ProgressChanged += ReportProgress; reconstructionProgress.ProgressChanged += ReportProgress; }
private static void ReconstructImage(SampledImage sampledImage, ISampledImageVisualizer visualizer, string sampler) { Bitmap reconstructedImage = visualizer.ReconstructImage(sampledImage); reconstructedImage.Save(string.Format("{0}{1}_reconstructed_{2}_{3}.png", RESULTS_DIR, INPUT_IMAGE, sampler, SAMPLE_COUNT)); }
private void imageVisualizerComboBox_SelectedIndexChanged(object sender, EventArgs e) { switch ((VisualizerType)imageVisualizerComboBox.SelectedValue) { case VisualizerType.Voronoi: visualizer = voronoiVisualizer; voronoiOptionsGroupBox.Enabled = true; break; case VisualizerType.Point: visualizer = pointVisualizer; voronoiOptionsGroupBox.Enabled = false; break; default: throw new NotImplementedException(); } }