/// <summary> /// Find all instances of a subimage in this image. /// </summary> /// <param name="subimage">The subimage to find in the larger image. Must be smaller than the image in both dimensions.</param> /// <returns>A Collection of rectangles indicating the matching locations. /// If there is no match, the Collection returned will be empty.</returns> public Collection <Rectangle> Find(Snapshot subimage) { return(Find(subimage, null)); }
/// <summary> /// Verifies a diffed image based on the number of pixels of a given brightness per color. /// A tolerance Histogram curve can be created from an XML file, produced from a reference image, or manually created for use as a tolerance. /// </summary> /// <param name="image">The actual Snapshot to be verified.</param> /// <returns>A VerificationResult enumeration value based on the image, the expected color, and the tolerance.</returns> public override VerificationResult Verify(Snapshot image) { Histogram actual = Histogram.FromSnapshot(image); return((actual.IsLessThan(Tolerance)) ? VerificationResult.Pass : VerificationResult.Fail); }
/// <summary> /// Compares the current Snapshot instance to the specified Snapshot to produce a difference image. /// Note: This does not compare alpha channels. /// </summary> /// <param name="snapshot">The Snapshot to be compared to.</param> /// <returns>A new Snapshot object representing the difference image (i.e. the result of the comparison).</returns> public Snapshot CompareTo(Snapshot snapshot) { return(CompareTo(snapshot, false)); }
/// <summary> /// Initializes a new instance of the SnapshotToleranceMapVerifier class, using the specified tolerance map. /// </summary> /// <param name="toleranceMap"> /// A Snapshot instance defining the tolerance map, used by the verifier. /// A black tolerance map (a snapshot, where all pixels are with zero values) means zero tolerance. /// A white tolerance map (a snapshot, where all pixels are with value 0xFF) means infinitely high tolerance. /// </param> public SnapshotToleranceMapVerifier(Snapshot toleranceMap) { this.ToleranceMap = toleranceMap; }