Пример #1
0
        private void AddDefaultKernels_Edges_Small()
        {
            AddKernel(Convolutions.GetEdge_Sobel(true));
            AddKernel(Convolutions.GetEdge_Sobel(false));
            AddKernel(Convolutions.Rotate_45(Convolutions.GetEdge_Sobel(true), true));
            AddKernel(Convolutions.Rotate_45(Convolutions.GetEdge_Sobel(false), true));

            AddKernel(Convolutions.GetEdge_Prewitt(true));
            AddKernel(Convolutions.GetEdge_Prewitt(false));
            AddKernel(Convolutions.Rotate_45(Convolutions.GetEdge_Prewitt(true), true));
            AddKernel(Convolutions.Rotate_45(Convolutions.GetEdge_Prewitt(false), true));

            AddKernel(Convolutions.GetEdge_Compass(true));
            AddKernel(Convolutions.GetEdge_Compass(false));
            AddKernel(Convolutions.Rotate_45(Convolutions.GetEdge_Compass(true), true));
            AddKernel(Convolutions.Rotate_45(Convolutions.GetEdge_Compass(false), true));

            AddKernel(Convolutions.GetEdge_Kirsch(true));
            AddKernel(Convolutions.GetEdge_Kirsch(false));
            AddKernel(Convolutions.Rotate_45(Convolutions.GetEdge_Kirsch(true), true));
            AddKernel(Convolutions.Rotate_45(Convolutions.GetEdge_Kirsch(false), true));

            AddKernel(Convolutions.GetEdge_Laplacian(true));
            AddKernel(Convolutions.GetEdge_Laplacian(false));
        }
Пример #2
0
        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);
        }