Table of Contents

Class VFPCompare

Namespace
VisioForge.Core.VideoFingerPrinting
Assembly
VisioForge.Core.dll

Provides static methods for building and comparing video fingerprints to determine content similarity.

public static class VFPCompare

Inheritance

Inherited Members

Methods

Build(out long, ref VFPCompareData)

Builds the final fingerprint data from all processed frames.

public static nint Build(out long length, ref VFPCompareData video)

Parameters

length long

Output parameter that receives the size of the fingerprint data in bytes.

video VFPCompareData

Reference to the comparison data containing processed frame information.

Returns

nint

Pointer to the newly allocated fingerprint data. Caller must free this memory using Marshal.FreeCoTaskMem.

Compare(VFPFingerPrint, VFPFingerPrint, int)

Compares two video fingerprints and returns a similarity score with automatic mirror detection.

public static double Compare(VFPFingerPrint fp1, VFPFingerPrint fp2, int maxDifference)

Parameters

fp1 VFPFingerPrint

The first fingerprint to compare.

fp2 VFPFingerPrint

The second fingerprint to compare.

maxDifference int

Maximum allowed difference for comparison sensitivity (higher values allow more variation).

Returns

double

Similarity score between 0 and 100, where higher values indicate greater similarity.

Remarks

Enhanced with automatic mirror detection (v15.8.4+):

This method now automatically detects and matches videos that have been mirrored or rotated:

  • Horizontal flip (left-right mirror)
  • Vertical flip (top-bottom mirror)
  • 180-degree rotation (both horizontal and vertical flip)

The method returns the best match across all orientations, ensuring accurate comparison even when videos have been transformed. This enhancement requires no code changes - existing implementations will automatically benefit from improved matching accuracy.

Backward compatibility: Existing code continues to work without modification. The performance impact is minimal (up to 4x comparison time in worst case when checking all orientations).

Note: If you need to know which specific mirror transformation was detected, use the VisioForge.Core.VideoFingerPrinting.VFPCompare.CompareMirror(VisioForge.Core.VideoFingerPrinting.VFPFingerPrint,VisioForge.Core.VideoFingerPrinting.VFPFingerPrint,System.Int32) method instead, which returns both the similarity score and the detected mirror mode.

CompareMirror(VFPFingerPrint, VFPFingerPrint, int)

Compares two fingerprints with explicit mirror detection information.

public static VFPComparisonResult CompareMirror(VFPFingerPrint data1, VFPFingerPrint data2, int maxShift)

Parameters

data1 VFPFingerPrint

First fingerprint data.

data2 VFPFingerPrint

Second fingerprint data.

maxShift int

Maximum time shift allowed in seconds.

Returns

VFPComparisonResult

Comparison result including similarity score and the specific mirror mode detected.

Remarks

This method provides the same mirror detection capabilities as the standard VisioForge.Core.VideoFingerPrinting.VFPCompare.Compare(VisioForge.Core.VideoFingerPrinting.VFPFingerPrint,VisioForge.Core.VideoFingerPrinting.VFPFingerPrint,System.Int32) method, but additionally returns information about which mirror transformation was detected.

Use cases:

  • When you need to know if videos are mirrored versions of each other
  • For forensic analysis requiring transformation details
  • When implementing UI that shows how videos match

The returned VisioForge.Core.VideoFingerPrinting.VFPComparisonResult includes:

  • Difference: Similarity score (lower is better match)
  • MirrorMode: The specific transformation detected (None, Horizontal, Vertical, or Both)
  • Success: Whether the comparison completed successfully

Note: The standard VisioForge.Core.VideoFingerPrinting.VFPCompare.Compare(VisioForge.Core.VideoFingerPrinting.VFPFingerPrint,VisioForge.Core.VideoFingerPrinting.VFPFingerPrint,System.Int32) method uses this functionality internally but only returns the similarity score for backward compatibility.

Process(nint, int, int, int, TimeSpan, ref VFPCompareData)

Processes a video frame in RGB24 format for fingerprint comparison.

public static int Process(nint ptr, int w, int h, int s, TimeSpan dTime, ref VFPCompareData data)

Parameters

ptr nint

Pointer to the RGB24 frame data.

w int

Width of the frame in pixels.

h int

Height of the frame in pixels.

s int

Stride (bytes per row) of the frame data.

dTime TimeSpan

Timestamp of the frame from the beginning of the video.

data VFPCompareData

Reference to the comparison data structure to update.

Returns

int

Status code where 0 indicates success.

SetLicenseKey(string)

Sets the license key for the video fingerprinting library.

public static void SetLicenseKey(string licenseKey)

Parameters

licenseKey string

The license key string to activate fingerprinting features.