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 VFPCompareInheritance
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
lengthlong-
Output parameter that receives the size of the fingerprint data in bytes.
videoVFPCompareData-
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
fp1VFPFingerPrint-
The first fingerprint to compare.
fp2VFPFingerPrint-
The second fingerprint to compare.
maxDifferenceint-
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
data1VFPFingerPrint-
First fingerprint data.
data2VFPFingerPrint-
Second fingerprint data.
maxShiftint-
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
ptrnint-
Pointer to the RGB24 frame data.
wint-
Width of the frame in pixels.
hint-
Height of the frame in pixels.
sint-
Stride (bytes per row) of the frame data.
dTimeTimeSpan-
Timestamp of the frame from the beginning of the video.
dataVFPCompareData-
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
licenseKeystring-
The license key string to activate fingerprinting features.