AForge.Point.EuclideanNorm C# (CSharp) Method

EuclideanNorm() public method

Calculate Euclidean norm of the vector comprised of the point's coordinates - distance from (0, 0) in other words.
public EuclideanNorm ( ) : float
return float
        public float EuclideanNorm( )
        {
            return (float) System.Math.Sqrt( X * X + Y * Y );
        }
    }

Usage Example

Ejemplo n.º 1
0
        private void DrawVelocityMap(UnmanagedImage output)
        {
            Point sumVelocity = new Point();

            int indention = 7;
            int step      = 10;

            Invoke(() => step = VelocitiesDistanceTrackBar.Value);

            //Point[,] velocityField = ((dynamic)_tracker).CalculateVelocityField(_currentPreprocessedImage, _previousPreprocessedImage);

            for (int x = indention; x < _frameSize.Width - indention; x += step)
            {
                for (int y = indention; y < _frameSize.Height - indention; y += step)
                {
                    IntPoint p        = new IntPoint(x, y);
                    Point    velocity = _tracker.CalculateVelocity(_currentPreprocessedImage, _previousPreprocessedImage, p);
                    //Point velocity = velocityField[y, x];

                    sumVelocity += velocity;

                    if (velocity.EuclideanNorm() != 0.0f)
                    {
                        IntPoint newp = (p + velocity).Round();
                        Drawing.Line(output, p, newp, Color.White);
                        output.SetPixel(newp, Color.Red);
                    }
                }
            }

            Invoke(() => InfoLabel.Text = string.Format("Summary motion: ({0:+00.00;-00.00}; {1:+00.00;-00.00})", sumVelocity.X / 10, sumVelocity.Y / 10));
        }
All Usage Examples Of AForge.Point::EuclideanNorm