AForge.IntPoint.Subtract C# (CSharp) Method

Subtract() public static method

Subtraction operator - subtracts values of two points.
public static Subtract ( IntPoint point1, IntPoint point2 ) : IntPoint
point1 IntPoint Point to subtract from.
point2 IntPoint Point to subtract.
return IntPoint
		public static IntPoint Subtract( IntPoint point1, IntPoint point2 )
		{
			return new IntPoint( point1.X - point2.X, point1.Y - point2.Y );
		}

Same methods

IntPoint::Subtract ( IntPoint point, int valueToSubtract ) : IntPoint

Usage Example

Example #1
0
        private void initTracking(Bgr <byte>[,] frame)
        {
            initializeKalman(roi.Center());

            //get hue channel from search area
            var hsvImg = frame.ToHsv();

            //user constraints...

            Gray <byte>[,] mask = hsvImg.InRange(new Hsv <byte>(0, 0, (byte)minV), new Hsv <byte>(0, 0, (byte)maxV), Byte.MaxValue, 2);

            originalObjHist.Calculate(hsvImg.SplitChannels <Hsv <byte>, byte>(roi, 0, 1), false, mask, roi.Location);
            originalObjHist.Scale((float)1 / roi.Area());
            //originalObjHist.Normalize(Byte.MaxValue);

            var backgroundArea = roi.Inflate(1.5, 1.5, frame.Size());
            var backgroundMask = mask.Clone(backgroundArea);

            backgroundMask.SetValue <Gray <byte> >(0, new Rectangle(Point.Subtract(roi.Location, backgroundArea.Location), roi.Size));

            backgroundHist.Calculate(hsvImg.SplitChannels <Hsv <byte>, byte>(backgroundArea, 0, 1), false, mask, backgroundArea.Location);
            backgroundHist.Scale((float)1 / (backgroundArea.Area() - roi.Area()));
            //backgroundHist.Normalize(Byte.MaxValue);

            //how good originalObjHist and objHist match (suppresses possible selected background)
            ratioHist = originalObjHist.CreateRatioHistogram(backgroundHist, Byte.MaxValue, 3);

            searchArea = roi;
            roi        = Rectangle.Empty;
        }
All Usage Examples Of AForge.IntPoint::Subtract