private void AddDefaultKernels_Gaussian() { int[] sizes = new[] { 3, 4, 5, 6, 7, 9, 15, 20, 30 }; foreach (int size in sizes) { AddKernel(Convolutions.GetGaussian(size, 1)); } foreach (int size in sizes) { AddKernel(Convolutions.GetGaussian(size, 2)); } }
public MineralIdentifier() { InitializeComponent(); this.Background = SystemColors.ControlBrush; #region Tab: Single Image // Camera Trackball _trackball = new TrackBallRoam(_camera); _trackball.EventSource = grdViewPort; //NOTE: If this control doesn't have a background color set, the trackball won't see events (I think transparent is ok, just not null) _trackball.AllowZoomOnMouseWheel = true; _trackball.Mappings.AddRange(TrackBallMapping.GetPrebuilt(TrackBallMapping.PrebuiltMapping.MouseComplete)); _trackball.MouseWheelScale *= .1; //_trackball.GetOrbitRadius += new GetOrbitRadiusHandler(Trackball_GetOrbitRadius); // Mineral Types foreach (MineralType mineral in Enum.GetValues(typeof(MineralType))) { cboMineral.Items.Add(mineral); } cboMineral.SelectedIndex = 0; #endregion #region Tab: Training Data #region Mineral Types foreach (MineralType mineral in Enum.GetValues(typeof(MineralType))) { CheckBox mineralCheckbox = new CheckBox() { Content = mineral.ToString(), Tag = mineral, Margin = new Thickness(2), }; pnlMineralSelections.Children.Add(mineralCheckbox); } #endregion #region Convolutions // Gaussian Subtract AddKernel(new ConvolutionSet2D(new[] { Convolutions.GetGaussian(3, 1) }, SetOperationType.Subtract)); // MaxAbs Sobel Convolution2D vert = Convolutions.GetEdge_Sobel(true); Convolution2D horz = Convolutions.GetEdge_Sobel(false); var singles = new[] { new Convolution2D(vert.Values, vert.Width, vert.Height, vert.IsNegPos, 1), new Convolution2D(horz.Values, horz.Width, horz.Height, horz.IsNegPos, 1), }; ConvolutionSet2D set = new ConvolutionSet2D(singles, SetOperationType.MaxOf); AddKernel(set); #endregion #endregion _initialized = true; cboMineral_SelectionChanged(this, null); ResetCamera_Click(this, null); }