Class VFPFingerprintFromFrames
- Namespace
- VisioForge.Core.VideoFingerPrinting
- Assembly
- VisioForge.Core.dll
Creates video fingerprints from individual image frames.
public class VFPFingerprintFromFramesInheritance
Inherited Members
Remarks
The VisioForge.Core.VideoFingerPrinting.VFPFingerprintFromFrames class allows creation of video fingerprints from a sequence of image frames rather than from a video file. This is useful when processing video streams, generated content, or when frames are already available in memory. The class accepts frames in RGB24 format, SKBitmap objects (cross-platform), or Bitmap objects (Windows only) and builds a fingerprint that can be used for content matching.
Constructors
VFPFingerprintFromFrames(double, int, int, TimeSpan)
Initializes a new instance of the VisioForge.Core.VideoFingerPrinting.VFPFingerprintFromFrames class.
public VFPFingerprintFromFrames(double frameRate, int width, int height, TimeSpan totalDuration)Parameters
frameRatedouble-
The frame rate of the video in frames per second.
widthint-
The width of the video frames in pixels.
heightint-
The height of the video frames in pixels.
totalDurationTimeSpan-
The total expected duration of the video content.
Remarks
All frames pushed to this instance must match the specified width and height. The frame rate is used to calculate proper timestamps for each frame. The total duration should be an estimate of the complete video length to properly initialize the fingerprinting algorithm.
Methods
Build()
Builds the final video fingerprint from all processed frames.
public VFPFingerPrint Build()Returns
- VFPFingerPrint
-
A VisioForge.Core.VideoFingerPrinting.VFPFingerPrint object containing the generated fingerprint data and metadata about the video.
Remarks
This method should be called after all frames have been pushed using the Push methods. It finalizes the fingerprint generation process and returns a fingerprint object that can be saved to disk or used for comparison operations. After calling Build, the internal resources are freed and this instance should not be used further.
~VFPFingerprintFromFrames()
Finalizes an instance of the VisioForge.Core.VideoFingerPrinting.VFPFingerprintFromFrames class.
protected ~VFPFingerprintFromFrames()Remarks
The finalizer ensures that any unmanaged memory allocated for temporary frame buffers is properly released even if Dispose is not called explicitly.
Push(byte[])
Adds an RGB24 frame to the fingerprint generation process.
public void Push(byte[] rgb24frame)Parameters
rgb24framebyte[]-
A byte array containing the frame data in RGB24 format (3 bytes per pixel).
Remarks
The frame data must be in RGB24 format with pixels stored in row-major order. Each pixel consists of 3 bytes representing red, green, and blue channels. Frames should be pushed in chronological order for accurate fingerprint generation.
Exceptions
- Exception
-
Thrown when the buffer size doesn't match the expected size (width * height * 3).
Push(SKBitmap)
Adds a SkiaSharp bitmap frame to the fingerprint generation process.
public void Push(SKBitmap frame)Parameters
frameSKBitmap-
A SkiaSharp.SKBitmap containing the video frame.
Remarks
The method accepts SKBitmap in any pixel format and automatically converts it to RGB24 format. The bitmap is not modified and can be reused after this call. Frames should be pushed in chronological order. This method is available on all platforms.
Exceptions
- Exception
-
Thrown when the frame dimensions don't match the expected width and height.
Push(nint, int)
Adds an RGB24 frame from unmanaged memory to the fingerprint generation process.
public void Push(nint rgb24frame, int rgb24frameSize)Parameters
rgb24framenint-
Pointer to the frame data in RGB24 format in unmanaged memory.
rgb24frameSizeint-
Size of the frame data in bytes. Must equal width * height * 3.
Remarks
This method is useful when working with frames from native libraries or when frames are already available in unmanaged memory. The timestamp for each frame is automatically calculated based on the frame rate and the order in which frames are pushed.