/// <summary> /// Return the Dot Product of two Vectors /// </summary> public static double DotProduct(ColorVector cv1, ColorVector cv2) { if (cv1 == null) { return(0); } if (cv2 == null) { return(0); } return((cv1.Red * cv2.Red) + (cv1.Green * cv2.Green) + (cv1.Blue * cv2.Blue)); }
/// <summary> /// Calculate the similarity between two color vectors /// </summary> public static double CompareSimilarity(ColorVector cv1, ColorVector cv2) { if (cv1 == null) { return(0); } if (cv2 == null) { return(0); } double mag = (cv1.Magnitude() * cv2.Magnitude()); if (mag != 0) { return(DotProduct(cv1, cv2) / mag); } return(0); }
/// <summary> /// Constructor with ColorVector /// </summary> public SetObjectTrackingColor(ColorVector body) : base(body) { }