Class FastImageProcessing
- Namespace
- VisioForge.Core
- Assembly
- VisioForge.Core.dll
Fast Image Processing - High-performance image processing operations using native C++ library (VisioForge_MFP.dll/VisioForge_MFP64.dll).
public static class FastImageProcessingInheritance
Inherited Members
Remarks
This class provides .NET P/Invoke wrappers around a native C++ library that implements various image processing operations using Intel IPP (Integrated Performance Primitives) for optimal performance.
Supported Image Formats:
- RGB24: 24-bit color, 3 bytes per pixel (Blue, Green, Red order in memory)
- RGB32/ARGB: 32-bit color with alpha, 4 bytes per pixel (Blue, Green, Red, Alpha order in memory)
Memory Layout Concepts:
- IntPtr pixels: Pointer to raw pixel data in memory, representing continuous buffer of color values
- int width, height: Image dimensions in pixels
- int stride: Number of bytes per image row (scan line), may include padding for alignment. For RGB24: typically width*3 rounded up. For RGB32: typically width*4
- Pixel addressing: Pixel at (x,y) is at offset: y * stride + x * bytesPerPixel
Platform Support:
- x86 (32-bit): Uses VisioForge_MFP.dll via MFPCoreX86 class
- x64 (64-bit): Uses VisioForge_MFP64.dll via MFPCoreX64 class
Performance Features:
- Smart multithreading: Automatically parallelizes operations for images larger than 200x200 pixels
- Intel IPP acceleration: Uses optimized SIMD instructions for fast processing
- Direct memory manipulation: Operates on raw pixel buffers without managed allocations
C++ Library Location: _SOURCE\MFP\VisioForge_MFP\
Methods
AddScrollingTextLogo(BaseContext, nint, int, int, int, ref VideoEffectScrollingTextLogo, TimeSpan, long)
Adds scrolling text logo.
public static void AddScrollingTextLogo(BaseContext context, nint pixels, int frameWidth, int frameHeight, int frameStride, ref VideoEffectScrollingTextLogo textLogo, TimeSpan timeStamp, long frameNumber)Parameters
contextBaseContext-
The context.
pixelsnint-
Pixels data.
frameWidthint-
The frame width.
frameHeightint-
The frame height.
frameStrideint-
The number of bytes per row in the frame buffer.
textLogoVideoEffectScrollingTextLogo-
The text logo.
timeStampTimeSpan-
The time stamp.
frameNumberlong-
Frame number.
Exceptions
AddTextLogo(BaseContext, nint, bool, nint, int, int, ref VideoEffectTextLogo, TimeSpan, long)
Adds text logo.
public static void AddTextLogo(BaseContext context, nint pixels, bool pixels32bit, nint pixels32tmp, int frameWidth, int frameHeight, ref VideoEffectTextLogo textLogo, TimeSpan timeStamp, long frameNumber)Parameters
contextBaseContext-
The context.
pixelsnint-
Pixels data.
pixels32bitbool-
The pixels 32 bit.
pixels32tmpnint-
The pixels32tmp.
frameWidthint-
The frame width.
frameHeightint-
The frame height.
textLogoVideoEffectTextLogo-
The text logo.
timeStampTimeSpan-
The time stamp.
frameNumberlong-
Frame number.
Exceptions
Blue(nint, int, int, bool)
Applies a blue color filter effect to an RGB24 image, removing red and green color channels.
public static void Blue(nint srcPixels, int srcWidth, int srcHeight, bool smartMultithreading = true)Parameters
srcPixelsnint-
Pointer to image pixel data (RGB24 format: 3 bytes per pixel, BGR order). Image is modified in-place.
srcWidthint-
Width of image in pixels
srcHeightint-
Height of image in pixels
smartMultithreadingbool-
if set to
true, uses parallel processing for images > 200x200 pixels
Remarks
Effect Description: Keeps only the blue channel, sets red and green to 0, creating a blue-tinted monochrome effect.
Pixel Transformation: For each pixel: R=0, G=0, B=unchanged
In-Place Operation: Modifies the source buffer directly without requiring additional memory.
Performance: Smart multithreading divides image into horizontal strips for parallel processing on multiple CPU cores.
Native Implementation: Calls EffectBlue in VisioForge_MFP.dll (C++ VideoEffects.cpp)
Blur(nint, int, int, nint, int)
Applies a blur effect to an RGB24 image using a convolution filter.
public static void Blur(nint srcPixels, int width, int height, nint tmpArray, int tmpArrayLen)Parameters
srcPixelsnint-
Pointer to image pixel data (RGB24 format: 3 bytes per pixel, BGR order). Image is modified in-place.
widthint-
Width of image in pixels
heightint-
Height of image in pixels
tmpArraynint-
Pointer to temporary working buffer (required for blur algorithm). Must be large enough as specified by tmpArrayLen.
tmpArrayLenint-
Size of temporary buffer in bytes. Should be at least width * height * 3 bytes for RGB24.
Remarks
Effect Description: Applies a smoothing/blurring filter by averaging neighboring pixels using convolution.
Algorithm: Uses a kernel-based convolution to create a smooth, blurred appearance.
Temporary Buffer: Requires an external temporary buffer to store intermediate results during processing.
In-Place Operation: Final result is written back to the source buffer.
Native Implementation: Calls EffectBlur in VisioForge_MFP.dll
BlurEx(nint, int, int, int, bool, bool, nint, int)
Applies a directional blur effect to an RGB24 image with control over blur range and direction.
public static void BlurEx(nint srcPixels, int width, int height, int range, bool vertical, bool horizontal, nint tmpArray, int tmpArrayLen)Parameters
srcPixelsnint-
Pointer to image pixel data (RGB24 format: 3 bytes per pixel, BGR order). Image is modified in-place.
widthint-
Width of image in pixels
heightint-
Height of image in pixels
rangeint-
Blur intensity/radius (higher values = more blur). Typical range: 1-20.
verticalbool-
if set to
true, applies vertical blur (top-to-bottom smoothing) horizontalbool-
if set to
true, applies horizontal blur (left-to-right smoothing) tmpArraynint-
Pointer to temporary working buffer required for blur algorithm
tmpArrayLenint-
Size of temporary buffer in bytes. Should be at least width * height * 3 bytes for RGB24.
Remarks
Directional Control: Can apply blur in vertical, horizontal, or both directions simultaneously.
Motion Blur Effect: Using only vertical or only horizontal creates a motion blur appearance.
Range Parameter: Controls the blur kernel size - larger values create stronger blur but slower processing.
Native Implementation: Calls EffectBlurEx in VisioForge_MFP.dll
Brightness(nint, int, int, int, bool)
Increases the brightness of an RGB24 image by adding a constant value to all color channels.
public static void Brightness(nint srcPixels, int srcWidth, int srcHeight, int amount, bool smartMultithreading = true)Parameters
srcPixelsnint-
Pointer to image pixel data (RGB24 format: 3 bytes per pixel, BGR order). Image is modified in-place.
srcWidthint-
Width of image in pixels
srcHeightint-
Height of image in pixels
amountint-
Brightness increase amount (0-255). Higher values = brighter image.
smartMultithreadingbool-
if set to
true, uses parallel processing for images > 200x200 pixels
Remarks
Effect Description: Adds the amount value to each RGB color channel, making the entire image lighter.
Algorithm: For each pixel: newR = min(R + amount, 255), newG = min(G + amount, 255), newB = min(B + amount, 255)
Amount Parameter:
- 0: No change
- 1-50: Subtle brightness increase
- 50-100: Moderate brightness increase
- 100-255: Strong brightness increase (may wash out colors)
Clamping: Values are clamped to 255 to prevent overflow, so very bright areas won't change.
Opposite Effect: Use VisioForge.Core.FastImageProcessing.Darkness(System.IntPtr,System.Int32,System.Int32,System.Int32,System.Boolean) to decrease brightness instead.
Native Implementation: Calls EffectLightness in VisioForge_MFP.dll
ColorNoise(nint, int, int, int, bool)
Adds random color noise to an RGB24 image, creating a colorful grain effect.
public static void ColorNoise(nint srcPixels, int srcWidth, int srcHeight, int amount, bool smartMultithreading = true)Parameters
srcPixelsnint-
Pointer to image pixel data (RGB24 format: 3 bytes per pixel, BGR order). Image is modified in-place.
srcWidthint-
Width of image in pixels
srcHeightint-
Height of image in pixels
amountint-
Intensity of noise effect (0-255). Higher values = more visible noise.
smartMultithreadingbool-
if set to
true, uses parallel processing for images > 200x200 pixels
Remarks
Effect Description: Adds random variations to each RGB color channel independently, creating colored speckles/grain.
Amount Parameter: Controls the maximum random deviation added to each color channel (0 = no effect, 255 = maximum noise).
Use Cases: Film grain simulation, artistic effects, noise addition for testing denoising algorithms.
Native Implementation: Calls EffectColorNoise in VisioForge_MFP.dll
Contrast(nint, int, int, int, bool)
Adjusts the contrast of an RGB24 image by increasing or decreasing the difference between light and dark areas.
public static void Contrast(nint srcPixels, int srcWidth, int srcHeight, int amount, bool smartMultithreading = true)Parameters
srcPixelsnint-
Pointer to image pixel data (RGB24 format: 3 bytes per pixel, BGR order). Image is modified in-place.
srcWidthint-
Width of image in pixels
srcHeightint-
Height of image in pixels
amountint-
Contrast adjustment amount (-255 to +255). Positive values increase contrast, negative values decrease contrast, 0 = no change.
smartMultithreadingbool-
if set to
true, uses parallel processing for images > 200x200 pixels
Remarks
Algorithm: Uses the formula: newValue = factor * (oldValue - 128) + 128, where factor depends on amount.
Effect Description: Makes bright pixels brighter and dark pixels darker (positive amount) or reduces the difference (negative amount).
Amount Parameter:
- Positive (1 to 255): Increases contrast, makes image more vivid
- Negative (-255 to -1): Decreases contrast, makes image more washed out
- 0: No change
Native Implementation: Calls EffectContrast in VisioForge_MFP.dll (C++ VideoEffects.cpp)
CopyImagePart(nint, int, int, int, nint, int)
Copies a sub-region of a source image row-by-row into a destination buffer of the same dimensions.
public static void CopyImagePart(nint srcData, int srcStride, int width, int height, nint destData, int destStride)Parameters
srcDatanint-
Pointer to the first row of source pixel data.
srcStrideint-
Bytes per row in the source buffer.
widthint-
Width of the region in pixels (unused directly — determined by
destStride). heightint-
Number of rows to copy.
destDatanint-
Pointer to the first row of the destination buffer.
destStrideint-
Bytes per row in the destination buffer; determines how many bytes are copied per row.
Crop24(nint, uint, uint, nint, VFRectIntl)
Crops a rectangular region from an RGB24 source image and copies it to an output buffer.
public static void Crop24(nint inPixels, uint inWidth, uint inHeight, nint outPixels, VFRectIntl cutArea)Parameters
inPixelsnint-
Pointer to source image pixel data (RGB24 format: 3 bytes per pixel, BGR order)
inWidthuint-
Width of source image in pixels
inHeightuint-
Height of source image in pixels
outPixelsnint-
Pointer to output buffer where cropped region will be written (RGB24 format)
cutAreaVFRectIntl-
Rectangle defining the region to crop (Left, Top, Right, Bottom coordinates)
Remarks
Operation: Extracts a rectangular portion of the source image and copies it to the output buffer.
Output Size: Output buffer must be at least (cutArea.Width * cutArea.Height * 3) bytes.
Cropped Dimensions: Width = cutArea.Right - cutArea.Left, Height = cutArea.Bottom - cutArea.Top
Coordinate System: (0, 0) is top-left corner of source image.
Bounds Checking: cutArea must be within source image bounds, otherwise results are undefined.
Use Cases: Extracting regions of interest, removing borders, creating thumbnails, zoom-in operations.
Performance: Efficient row-by-row memory copy, suitable for real-time processing.
Related: See VisioForge.Core.FastImageProcessing.Crop32(System.IntPtr,System.UInt32,System.UInt32,System.IntPtr,VisioForge.Core.Types.VFRectIntl) for RGB32/ARGB format, VisioForge.Core.FastImageProcessing.ImageCutRGB24(System.IntPtr,System.Int32,System.Int32,System.IntPtr,System.Int32,System.Int32) for simpler interface.
Native Implementation: Calls Crop24 in VisioForge_MFP.dll
Crop32(nint, uint, uint, nint, VFRectIntl)
Crops a rectangular region from an RGB32/ARGB source image and copies it to an output buffer.
public static void Crop32(nint inPixels, uint inWidth, uint inHeight, nint outPixels, VFRectIntl cutArea)Parameters
inPixelsnint-
Pointer to source image pixel data (RGB32/ARGB format: 4 bytes per pixel, BGRA order)
inWidthuint-
Width of source image in pixels
inHeightuint-
Height of source image in pixels
outPixelsnint-
Pointer to output buffer where cropped region will be written (RGB32 format)
cutAreaVFRectIntl-
Rectangle defining the region to crop (Left, Top, Right, Bottom coordinates)
Remarks
Operation: Extracts a rectangular portion of the source image and copies it to the output buffer.
Output Size: Output buffer must be at least (cutArea.Width * cutArea.Height * 4) bytes.
Cropped Dimensions: Width = cutArea.Right - cutArea.Left, Height = cutArea.Bottom - cutArea.Top
Coordinate System: (0, 0) is top-left corner of source image.
Bounds Checking: cutArea must be within source image bounds, otherwise results are undefined.
Use Cases: Extracting regions of interest, removing borders, preparing thumbnails, focus on specific image areas.
Performance: Fast memory copy operation, suitable for real-time video processing.
Related: See VisioForge.Core.FastImageProcessing.Crop24(System.IntPtr,System.UInt32,System.UInt32,System.IntPtr,VisioForge.Core.Types.VFRectIntl) for RGB24 format, VisioForge.Core.FastImageProcessing.ImageCutRGB32(System.IntPtr,System.Int32,System.Int32,System.IntPtr,System.Int32,System.Int32) for simpler interface.
Native Implementation: Calls Crop32 in VisioForge_MFP.dll
Darkness(nint, int, int, int, bool)
Decreases the brightness of an RGB24 image by subtracting a constant value from all color channels.
public static void Darkness(nint srcPixels, int srcWidth, int srcHeight, int amount, bool smartMultithreading = true)Parameters
srcPixelsnint-
Pointer to image pixel data (RGB24 format: 3 bytes per pixel, BGR order). Image is modified in-place.
srcWidthint-
Width of image in pixels
srcHeightint-
Height of image in pixels
amountint-
Brightness decrease amount (0-255). Higher values = darker image.
smartMultithreadingbool-
if set to
true, uses parallel processing for images > 200x200 pixels
Remarks
Effect Description: Subtracts the amount value from each RGB color channel, making the entire image darker.
Algorithm: For each pixel: newR = max(R - amount, 0), newG = max(G - amount, 0), newB = max(B - amount, 0)
Amount Parameter:
- 0: No change
- 1-50: Subtle darkness increase
- 50-100: Moderate darkness increase
- 100-255: Strong darkness increase (may make image nearly black)
Clamping: Values are clamped to 0 to prevent underflow, so very dark areas become black.
Opposite Effect: Use VisioForge.Core.FastImageProcessing.Brightness(System.IntPtr,System.Int32,System.Int32,System.Int32,System.Boolean) to increase brightness instead.
Native Implementation: Calls EffectDarkness in VisioForge_MFP.dll
DeinterlaceBlend(HistoryFrame, nint, int, int, int, int, MFPDeinterlaceBlend)
Applies blend-based deinterlacing using three consecutive fields/frames to remove interlacing artifacts.
public static void DeinterlaceBlend(HistoryFrame historyFrame, nint output, int width, int height, int srcPitch, int destPitch, MFPDeinterlaceBlend deintBlend)Parameters
historyFrameHistoryFrame-
HistoryFrame object containing three consecutive frames (Frame0=previous, Frame1=current, Frame2=next)
outputnint-
Pointer to output buffer for deinterlaced frame. Must be at least width * height * 3 bytes.
widthint-
Width of frames in pixels
heightint-
Height of frames in pixels
srcPitchint-
Stride (bytes per row) for source frames. Typically width * 3 for RGB24.
destPitchint-
Stride (bytes per row) for output frame. Typically width * 3 for RGB24.
deintBlendMFPDeinterlaceBlend-
Deinterlacing blend parameters structure containing blend mode and strength settings
Remarks
Blend Deinterlacing: Uses temporal blending of three consecutive frames to reconstruct missing scan lines.
Algorithm:
- Identifies which scan lines belong to which field (odd vs even)
- For missing lines, blends corresponding lines from previous and next frames
- Applies weighted average based on motion detection and blend parameters
- Preserves original scan lines, only interpolates missing ones
Blend Modes: Different blending strategies can be specified in deintBlend parameter:
- Simple average: (Frame0 + Frame2) / 2 for missing lines
- Weighted blend: Frame1 contributes more for static areas
- Motion-adaptive: Adjusts blend based on detected motion
Quality Trade-offs:
- Better than single-frame methods for static content
- Can cause ghosting/blur with fast motion
- Good balance between quality and computational cost
Use Cases: Deinterlacing video from broadcast, DVD, VHS; converting interlaced to progressive scan.
Requirements: Requires 3-frame buffer (current + adjacent frames).
Native Implementation: Calls EffectDeinterlaceBlend in VisioForge_MFP.dll
DeinterlaceCAVT(nint, int, int, nint, int)
Applies CAVT (Content Adaptive Vertical Temporal) deinterlacing to remove interlacing artifacts from video frames.
public static void DeinterlaceCAVT(nint srcPixels, int width, int height, nint temp, int threshold)Parameters
srcPixelsnint-
Pointer to interlaced frame pixel data (RGB24 format: 3 bytes per pixel, BGR order). Frame is modified in-place.
widthint-
Width of frame in pixels
heightint-
Height of frame in pixels
tempnint-
Pointer to temporary working buffer. Must be at least width * height * 3 bytes.
thresholdint-
Motion detection threshold (0-255). Higher values = more aggressive deinterlacing. Typical range: 10-50.
Remarks
Interlacing Background: Interlaced video contains two fields (odd/even scan lines) captured at different times, causing combing artifacts on moving objects.
CAVT Algorithm:
- Analyzes vertical and temporal differences between scan lines
- Detects motion using threshold parameter
- Adaptively blends or interpolates pixels to remove combing while preserving detail
Threshold Parameter:
- Low values (5-15): Less aggressive, preserves more original detail, may leave slight combing
- Medium values (15-35): Balanced approach, removes most combing
- High values (35-100): Very aggressive, removes all combing but may blur fine details
Use Case: Deinterlacing broadcast video, VHS captures, or any interlaced source material.
Native Implementation: Calls EffectDeinterlaceCAVT in VisioForge_MFP.dll
DeinterlaceTriangle(nint, int, int, nint, int)
Applies Triangle deinterlacing using weighted interpolation between scan lines.
public static void DeinterlaceTriangle(nint srcPixels, int width, int height, nint temp, int weight)Parameters
srcPixelsnint-
Pointer to interlaced frame pixel data (RGB24 format: 3 bytes per pixel, BGR order). Frame is modified in-place.
widthint-
Width of frame in pixels
heightint-
Height of frame in pixels
tempnint-
Pointer to temporary working buffer. Must be at least width * height * 3 bytes.
weightint-
Interpolation weight (0-100). Controls blending between adjacent scan lines. 50 = equal weighting.
Remarks
Triangle Deinterlacing: Uses weighted average of neighboring scan lines to interpolate missing field data.
Algorithm:
- For each scan line from one field, interpolates from adjacent lines in the other field
- Uses triangle-shaped weighting kernel (closer lines have more influence)
- Weight parameter controls the interpolation curve
Weight Parameter:
- 0: Uses only current field (no interpolation)
- 50: Equal blending of adjacent lines (standard linear interpolation)
- 100: Maximum interpolation from neighboring lines
Quality Trade-off: Simpler than CAVT but may blur static areas. Good for motion-heavy content.
Native Implementation: Calls EffectDeinterlaceTriangle in VisioForge_MFP.dll
DenoiseAdaptive(HistoryFrame, nint, int, int, int, int, byte, byte)
Applies adaptive temporal noise reduction using three consecutive video frames with threshold-based filtering.
public static void DenoiseAdaptive(HistoryFrame historyFrame, nint output, int width, int height, int srcPitch, int destPitch, byte threshold, byte blurType)Parameters
historyFrameHistoryFrame-
HistoryFrame object containing three consecutive frames (Frame0=previous, Frame1=current, Frame2=next)
outputnint-
Pointer to output buffer for denoised frame. Must be at least width * height * 3 bytes.
widthint-
Width of frames in pixels
heightint-
Height of frames in pixels
srcPitchint-
Stride (bytes per row) for source frames. Typically width * 3 for RGB24.
destPitchint-
Stride (bytes per row) for output frame. Typically width * 3 for RGB24.
thresholdbyte-
Motion detection threshold (0-255). Higher values = more aggressive denoising. Typical: 10-30.
blurTypebyte-
Type of blur to apply (0=none, 1=light, 2=medium, 3=strong). Controls spatial smoothing strength.
Remarks
Adaptive Temporal Denoising: Uses three consecutive frames to distinguish between noise and actual motion/detail.
Algorithm:
- Compares Frame1 (current) with Frame0 (previous) and Frame2 (next)
- If pixel difference between frames < threshold: likely noise, apply temporal averaging
- If pixel difference > threshold: likely motion/detail, preserve original value
- Optionally applies spatial blur based on blurType for additional smoothing
Threshold Parameter:
- 5-15: Conservative, preserves most motion, removes minimal noise
- 15-30: Balanced, good for typical video noise
- 30-50: Aggressive, strong denoising, may blur fast motion
Blur Type:
- 0: No spatial blur (temporal only)
- 1: Light blur (subtle smoothing)
- 2: Medium blur (moderate smoothing)
- 3: Strong blur (heavy smoothing, may lose fine detail)
Use Cases: Video noise reduction, improving compressed video quality, cleaning surveillance footage, reducing sensor noise.
Advantages: Preserves edges and motion better than single-frame denoisers; removes temporal noise effectively.
Requirements: Must maintain 3-frame buffer. Best for sequences with moderate motion.
Native Implementation: Calls EffectDenoiseAdaptive in VisioForge_MFP.dll
DenoiseCAST(nint, nint, int, int, int, MFPDenoiseCAST)
Applies CAST (Coupled Anisotropic Spatial Temporal) noise reduction using current and previous frames with Intel IPP.
public static void DenoiseCAST(nint frame, nint prevFrame, int width, int height, int srcPitch, MFPDenoiseCAST denoiseCAST)Parameters
framenint-
Pointer to current frame pixel data (RGB24 format: 3 bytes per pixel, BGR order). Frame is denoised in-place.
prevFramenint-
Pointer to previous frame pixel data for temporal comparison. Must be same size and format as current frame.
widthint-
Width of frames in pixels
heightint-
Height of frames in pixels
srcPitchint-
Stride (bytes per row) for both frames. Typically width * 3 for RGB24.
denoiseCASTMFPDenoiseCAST-
CAST denoising parameters structure containing threshold and algorithm settings
Remarks
CAST Algorithm: Advanced temporal denoising using Intel IPP that analyzes both spatial (within frame) and temporal (between frames) information.
How It Works:
- Detects edges in current frame using edge detection
- Compares current frame with previous frame to identify static vs moving areas
- Applies stronger denoising to static areas (temporal filtering)
- Preserves edges and moving areas to avoid motion blur
Anisotropic: Applies different filtering strengths in different directions to preserve edges while removing noise.
Coupled: Combines spatial filtering (within frame) with temporal filtering (across frames) for superior results.
Use Cases: Video denoising for surveillance footage, low-light video enhancement, cleaning up compressed video artifacts.
Requirements: Requires storing previous frame for temporal comparison. Best results with static camera or minimal motion.
Performance: More computationally expensive than single-frame denoisers due to temporal analysis.
Native Implementation: Calls EffectDenoiseCAST in VisioForge_MFP.dll (uses Intel IPP ippiFilterDenoiseCAST functions)
DenoiseMosquito(HistoryFrame, nint, int, int, int, int)
Removes mosquito noise artifacts using three consecutive frames with temporal filtering.
public static void DenoiseMosquito(HistoryFrame historyFrame, nint output, int width, int height, int srcPitch, int destPitch)Parameters
historyFrameHistoryFrame-
HistoryFrame object containing three consecutive frames (Frame0=previous, Frame1=current, Frame2=next)
outputnint-
Pointer to output buffer for denoised frame. Must be at least width * height * 3 bytes.
widthint-
Width of frames in pixels
heightint-
Height of frames in pixels
srcPitchint-
Stride (bytes per row) for source frames. Typically width * 3 for RGB24.
destPitchint-
Stride (bytes per row) for output frame. Typically width * 3 for RGB24.
Remarks
Mosquito Noise: Characteristic artifact of lossy video compression (MPEG, H.264) appearing as shimmering dots or patterns around edges.
Artifact Characteristics:
- Appears as crawling or shimmering patterns near high-contrast edges
- Caused by quantization errors in DCT coefficients
- Temporal: Changes frame-to-frame even in static scenes
- Most visible in flat areas adjacent to sharp edges
Algorithm:
- Detects edges in current frame (Frame1)
- Identifies potential mosquito noise near edges using temporal analysis
- Compares Frame1 with Frame0 and Frame2 to distinguish noise from real detail
- Applies temporal smoothing only to identified noise patterns
- Preserves actual edges and details
Use Cases:
- Cleaning up heavily compressed video (low bitrate MPEG, web video)
- Improving visual quality of streaming content
- Post-processing for video conferencing
- Archival restoration of compressed video
Requirements: Requires 3-frame buffer for temporal analysis.
Limitations: Most effective on static or slowly moving scenes; fast motion may reduce effectiveness.
Native Implementation: Calls EffectDenoiseMosquito in VisioForge_MFP.dll
DenoiseSNR(nint, int, int, nint, int)
Applies SNR (Signal-to-Noise Ratio) based noise reduction to an RGB24 image.
public static void DenoiseSNR(nint srcPixels, int width, int height, nint temp, int threshold)Parameters
srcPixelsnint-
Pointer to image pixel data (RGB24 format: 3 bytes per pixel, BGR order). Image is modified in-place.
widthint-
Width of image in pixels
heightint-
Height of image in pixels
tempnint-
Pointer to temporary working buffer. Must be at least width * height * 3 bytes.
thresholdint-
Noise threshold (0-255). Higher values = more aggressive denoising. Typical range: 10-50.
Remarks
SNR Denoising: Reduces random noise while preserving edges and details based on signal-to-noise analysis.
Algorithm:
- Analyzes local pixel variations to distinguish noise from actual image features
- Applies smoothing only in areas identified as noisy (low signal-to-noise ratio)
- Preserves sharp edges and high-contrast features
Threshold Parameter:
- Low (5-15): Mild denoising, preserves maximum detail, removes minimal noise
- Medium (15-35): Balanced noise reduction, good for typical camera noise
- High (35-100): Strong denoising, may blur fine textures
Use Cases: Cleaning up digital camera noise, low-light video, compressed video artifacts.
Native Implementation: Calls EffectDenoiseSNR in VisioForge_MFP.dll
DrawX_ARGBOnARGB_SLOW(VideoFrameX, Rect, VideoFrameX, int, int)
Composites an ARGB source sub-rectangle onto an ARGB destination frame using per-pixel alpha blending. This overload accepts VisioForge.Core.Types.X.VideoFrameX wrapper objects for convenience.
public static void DrawX_ARGBOnARGB_SLOW(VideoFrameX inFrame, Rect inRect, VideoFrameX destFrame, int destX, int destY)Parameters
inFrameVideoFrameX-
Source ARGB frame.
inRectRect-
Sub-rectangle within
inFrameto composite. destFrameVideoFrameX-
Destination ARGB frame that receives the blended result.
destXint-
Horizontal offset in the destination frame where the source rectangle is placed.
destYint-
Vertical offset in the destination frame where the source rectangle is placed.
DrawX_ARGBOnARGB_SLOW(nint, int, int, int, nint, int, int, int, int, int, int, int, int, int)
Composites an ARGB source sub-rectangle onto an ARGB destination frame using per-pixel alpha blending. This overload operates on raw pixel data pointers.
public static void DrawX_ARGBOnARGB_SLOW(nint srcData, int srcWidth, int srcHeight, int srcStride, nint destData, int destWidth, int destHeight, int destStride, int srcX, int srcY, int destX, int destY, int width, int height)Parameters
srcDatanint-
Pointer to source image pixel data (ARGB format).
srcWidthint-
Width of the source image in pixels.
srcHeightint-
Height of the source image in pixels.
srcStrideint-
Bytes per row in the source image.
destDatanint-
Pointer to destination image pixel data (ARGB format).
destWidthint-
Width of the destination image in pixels.
destHeightint-
Height of the destination image in pixels.
destStrideint-
Bytes per row in the destination image.
srcXint-
Horizontal offset within the source image for the copy region.
srcYint-
Vertical offset within the source image for the copy region.
destXint-
Horizontal offset in the destination frame where the source is placed.
destYint-
Vertical offset in the destination frame where the source is placed.
widthint-
Width of the region to composite in pixels.
heightint-
Height of the region to composite in pixels.
Draw_RGB24OnRGB24Old(nint, int, int, nint, int, int, int, int)
Draws (composites) an RGB24 source image onto an RGB24 destination image at specified coordinates (legacy version without stride parameter).
public static void Draw_RGB24OnRGB24Old(nint srcPixels, int srcWidth, int srcHeight, nint destPixels, int destWidth, int destHeight, int x, int y)Parameters
srcPixelsnint-
Pointer to source image pixel data (RGB24 format: 3 bytes per pixel, BGR order)
srcWidthint-
Width of source image in pixels
srcHeightint-
Height of source image in pixels
destPixelsnint-
Pointer to destination image pixel data (RGB24 format)
destWidthint-
Width of destination image in pixels
destHeightint-
Height of destination image in pixels
xint-
X coordinate in destination image where top-left corner of source will be placed
yint-
Y coordinate in destination image where top-left corner of source will be placed
Remarks
Legacy Method: This is an older version that assumes standard stride (width * 3 for RGB24).
For better control over memory layout, use VisioForge.Core.FastImageProcessing.Draw_RGB24OnRGB24S(System.IntPtr,System.Int32,System.Int32,System.Int32,System.IntPtr,System.Int32,System.Int32,System.Int32,System.Int32,System.Int32) which accepts stride parameters.
Native Implementation: Calls Draw_RGB24OnRGB24 in VisioForge_MFP.dll
Draw_RGB24OnRGB24S(nint, int, int, int, nint, int, int, int, int, int)
Draws (composites) an RGB24 source image onto an RGB24 destination image at specified coordinates.
public static void Draw_RGB24OnRGB24S(nint srcPixels, int srcWidth, int srcHeight, int srcStride, nint destPixels, int destWidth, int destHeight, int destStride, int x, int y)Parameters
srcPixelsnint-
Pointer to source image pixel data (RGB24 format: 3 bytes per pixel, BGR order)
srcWidthint-
Width of source image in pixels
srcHeightint-
Height of source image in pixels
srcStrideint-
Number of bytes per row in source image (typically width * 3, may include padding)
destPixelsnint-
Pointer to destination image pixel data (RGB24 format)
destWidthint-
Width of destination image in pixels
destHeightint-
Height of destination image in pixels
destStrideint-
Number of bytes per row in destination image
xint-
X coordinate in destination image where top-left corner of source will be placed
yint-
Y coordinate in destination image where top-left corner of source will be placed
Remarks
Operation: Copies source image pixels directly onto destination image without alpha blending.
Memory Format: RGB24 uses 3 bytes per pixel in BGR order (Blue byte, Green byte, Red byte)
Clipping: If source extends beyond destination boundaries, it will be automatically clipped
Performance: Uses optimized native code with SIMD instructions for fast pixel copying
Native Implementation: Calls Draw_RGB24OnRGB24S in VisioForge_MFP.dll (C++ VideoEffects.cpp)
Draw_RGB24OnRGB24_Transp(nint, int, int, nint, int, int, int, int, int)
Draws the RGB24 image on RGB24 image with transparency.
public static void Draw_RGB24OnRGB24_Transp(nint srcPixels, int srcWidth, int srcHeight, nint destPixels, int destWidth, int destHeight, int x, int y, int transp)Parameters
srcPixelsnint-
The source pixels.
srcWidthint-
Width of the source.
srcHeightint-
Height of the source.
destPixelsnint-
The dest pixels.
destWidthint-
Width of the dest.
destHeightint-
Height of the dest.
xint-
The x.
yint-
The y.
transpint-
The transp.
Draw_RGB24OnRGB32(nint, int, int, nint, int, int, int, int)
Draws (composites) an RGB24 source image onto an RGB32 destination image at specified coordinates.
public static void Draw_RGB24OnRGB32(nint srcPixels, int srcWidth, int srcHeight, nint destPixels, int destWidth, int destHeight, int x, int y)Parameters
srcPixelsnint-
Pointer to source image pixel data (RGB24 format: 3 bytes per pixel, BGR order)
srcWidthint-
Width of source image in pixels
srcHeightint-
Height of source image in pixels
destPixelsnint-
Pointer to destination image pixel data (RGB32/ARGB format: 4 bytes per pixel, BGRA order)
destWidthint-
Width of destination image in pixels
destHeightint-
Height of destination image in pixels
xint-
X coordinate in destination image where top-left corner of source will be placed
yint-
Y coordinate in destination image where top-left corner of source will be placed
Remarks
Format Conversion: Converts RGB24 (3 bytes/pixel) to RGB32 (4 bytes/pixel) during compositing.
Alpha Channel: The alpha channel in destination will be set to fully opaque (255) for drawn pixels.
Memory Format: RGB24 = BGR, RGB32 = BGRA (Blue, Green, Red, Alpha bytes)
Native Implementation: Calls Draw_RGB24OnRGB32 in VisioForge_MFP.dll
Draw_RGB24_TraspChange(nint, int, int, int)
Change the RGB24 image transparency.
public static void Draw_RGB24_TraspChange(nint pixels, int width, int height, int transp)Parameters
Draw_RGB32OnRGB24(nint, int, int, nint, int, int, int, int, bool)
Draws (composites) an RGB32/ARGB source image onto an RGB24 destination image with alpha blending and optional smart multithreading.
public static void Draw_RGB32OnRGB24(nint srcPixels, int srcWidth, int srcHeight, nint destPixels, int destWidth, int destHeight, int x, int y, bool smartMultithreading = true)Parameters
srcPixelsnint-
Pointer to source image pixel data (RGB32/ARGB format: 4 bytes per pixel, BGRA order with alpha channel)
srcWidthint-
Width of source image in pixels
srcHeightint-
Height of source image in pixels
destPixelsnint-
Pointer to destination image pixel data (RGB24 format: 3 bytes per pixel, BGR order)
destWidthint-
Width of destination image in pixels
destHeightint-
Height of destination image in pixels
xint-
X coordinate in destination image where top-left corner of source will be placed
yint-
Y coordinate in destination image where top-left corner of source will be placed
smartMultithreadingbool-
if set to
true, automatically uses parallel processing for large images (> 200x200 pixels)
Remarks
Alpha Blending: Uses the alpha channel from source RGB32 image to blend with destination RGB24.
Format Conversion: Converts RGB32 (4 bytes/pixel with alpha) to RGB24 (3 bytes/pixel) with blending.
Smart Multithreading: When enabled and image is large enough, divides work across CPU cores for faster processing.
Memory Layout: Automatically calculates stride as width * 4 for RGB32, width * 3 for RGB24.
Internally calls VisioForge.Core.FastImageProcessing.Draw_RGB32OnRGB24S(System.IntPtr,System.Int32,System.Int32,System.Int32,System.IntPtr,System.Int32,System.Int32,System.Int32,System.Int32,System.Int32,System.Boolean) with calculated stride values.
Draw_RGB32OnRGB24POS(nint, int, int, int, int, int, nint, int, int, int, int, int)
Draws (composites) a portion of RGB32/ARGB source image onto an RGB24 destination image with position control.
public static void Draw_RGB32OnRGB24POS(nint inPixels, int inWidth, int inHeight, int inStride, int srcX, int srcY, nint destPixels, int destWidth, int destHeight, int destStride, int destX, int destY)Parameters
inPixelsnint-
Pointer to source image pixel data (RGB32/ARGB format: 4 bytes per pixel, BGRA order)
inWidthint-
Width of entire source image in pixels
inHeightint-
Height of entire source image in pixels
inStrideint-
Number of bytes per row in source image (typically width * 4)
srcXint-
X coordinate in source image to start reading from
srcYint-
Y coordinate in source image to start reading from
destPixelsnint-
Pointer to destination image pixel data (RGB24 format: 3 bytes per pixel, BGR order)
destWidthint-
Width of entire destination image in pixels
destHeightint-
Height of entire destination image in pixels
destStrideint-
Number of bytes per row in destination image (typically width * 3)
destXint-
X coordinate in destination image where source portion will be placed
destYint-
Y coordinate in destination image where source portion will be placed
Remarks
Partial Image Compositing: Allows compositing a specific region from source to a specific position in destination.
Use Case: Useful for tiling, sprite rendering, or combining image regions.
Alpha Blending: Uses alpha channel from source for proper transparency blending.
Native Implementation: Calls Draw_RGB32OnRGB24POS in VisioForge_MFP.dll
Draw_RGB32OnRGB24S(nint, int, int, int, nint, int, int, int, int, int, bool)
Draws (composites) an RGB32/ARGB source image onto an RGB24 destination image with alpha blending and smart multithreading support.
public static void Draw_RGB32OnRGB24S(nint srcPixels, int srcWidth, int srcHeight, int srcStride, nint destPixels, int destWidth, int destHeight, int destStride, int x, int y, bool smartMultithreading = true)Parameters
srcPixelsnint-
Pointer to source image pixel data (RGB32/ARGB format: 4 bytes per pixel, BGRA order with alpha channel)
srcWidthint-
Width of source image in pixels
srcHeightint-
Height of source image in pixels
srcStrideint-
Number of bytes per row in source image (typically width * 4, may include padding for alignment)
destPixelsnint-
Pointer to destination image pixel data (RGB24 format: 3 bytes per pixel, BGR order)
destWidthint-
Width of destination image in pixels
destHeightint-
Height of destination image in pixels
destStrideint-
Number of bytes per row in destination image (typically width * 3, may include padding)
xint-
X coordinate in destination image where top-left corner of source will be placed
yint-
Y coordinate in destination image where top-left corner of source will be placed
smartMultithreadingbool-
if set to
true, uses parallel processing for images > 200x200 pixels
Remarks
Smart Multithreading Implementation:
- For small images (< 40,000 pixels): Single-threaded processing
- For large images: Divides image into horizontal bands, one per CPU core
- Uses System.Threading.Tasks.Parallel.For for parallel band processing
- Handles remainder pixels if image height not evenly divisible by thread count
Alpha Blending: Uses alpha channel (4th byte) from source to blend with destination RGB values.
Automatic Clipping: Source is automatically clipped if it extends beyond destination boundaries.
Native Implementation: Calls Draw_RGB32OnRGB24S in VisioForge_MFP.dll (uses Intel IPP for SIMD acceleration)
Draw_RGB32OnRGB24SX(nint, Rect, int, nint, int, int, int, int, int)
Draws the RGB32 image on RGB24 image.
public static void Draw_RGB32OnRGB24SX(nint srcPixels, Rect srcRect, int srcStride, nint destPixels, int destWidth, int destHeight, int destStride, int x, int y)Parameters
srcPixelsnint-
The source data.
srcRectRect-
The rectangular region of the source image to draw.
srcStrideint-
The source stride.
destPixelsnint-
The destination data.
destWidthint-
Width of the destination.
destHeightint-
Height of the destination.
destStrideint-
The destination stride.
xint-
The x.
yint-
The y.
Draw_RGB32OnRGB24_Transp(nint, int, int, nint, int, int, int, int, int)
Draws the RGB32 image on RGB24 image with transparency.
public static void Draw_RGB32OnRGB24_Transp(nint srcPixels, int srcWidth, int srcHeight, nint destPixels, int destWidth, int destHeight, int x, int y, int transp)Parameters
srcPixelsnint-
The source data.
srcWidthint-
Width of the source.
srcHeightint-
Height of the source.
destPixelsnint-
The destination data.
destWidthint-
Width of the destination.
destHeightint-
Height of the destination.
xint-
The x.
yint-
The y.
transpint-
The transparency.
Draw_RGB32OnRGB32(nint, int, int, nint, int, int, int, int, nint, int, int)
Draws the RGB32 image on RGB32 image.
public static void Draw_RGB32OnRGB32(nint srcPixels, int srcWidth, int srcHeight, nint destPixels, int destWidth, int destHeight, int x, int y, nint tmpPixels, int tmpWidth, int tmpHeight)Parameters
srcPixelsnint-
The source data.
srcWidthint-
Width of the source.
srcHeightint-
Height of the source.
destPixelsnint-
The destination data.
destWidthint-
Width of the destination.
destHeightint-
Height of the destination.
xint-
The x.
yint-
The y.
tmpPixelsnint-
The temporary data.
tmpWidthint-
Width of the temporary data.
tmpHeightint-
Height of the temporary data.
FadeInOut(nint, int, int, long, long, long, bool)
Applies a fade-in or fade-out effect to an RGB24 image based on time position within a time range.
public static void FadeInOut(nint data, int width, int height, long startTime, long stopTime, long currentTime, bool fadeIn)Parameters
datanint-
Pointer to image pixel data (RGB24 format: 3 bytes per pixel, BGR order). Image is modified in-place.
widthint-
Width of image in pixels
heightint-
Height of image in pixels
startTimelong-
Start time of fade effect in ticks or milliseconds (beginning of fade range)
stopTimelong-
End time of fade effect in ticks or milliseconds (end of fade range)
currentTimelong-
Current time position in ticks or milliseconds (must be between startTime and stopTime)
fadeInbool-
if set to
true, applies fade-in (from black to full brightness); otherwise fade-out (from full brightness to black)
Remarks
Fade Effect: Gradually adjusts image brightness over time to create smooth transitions.
Algorithm:
- Calculates progress: progress = (currentTime - startTime) / (stopTime - startTime), range 0.0 to 1.0
- For fade-in: multiplier = progress (0.0 = black, 1.0 = full)
- For fade-out: multiplier = (1.0 - progress) (1.0 = full, 0.0 = black)
- Multiplies each RGB channel by multiplier: newValue = oldValue * multiplier
Fade-In Behavior:
- At startTime: Image is completely black (all pixels = 0)
- Between times: Image gradually brightens proportionally
- At stopTime: Image is at full original brightness
Fade-Out Behavior:
- At startTime: Image is at full original brightness
- Between times: Image gradually darkens proportionally
- At stopTime: Image is completely black (all pixels = 0)
Time Units: Time values should use consistent units (all milliseconds or all ticks). Only relative differences matter.
Clamping: If currentTime is outside [startTime, stopTime] range, effect will clamp to nearest endpoint (fully bright or fully dark).
Use Cases: Video transitions, scene changes, title sequences, end credits, crossfades (combined with compositing).
Performance: Simple per-pixel multiplication, suitable for real-time video processing.
Native Implementation: Calls EffectFadeInOut in VisioForge_MFP.dll
FillColor(nint, int, int, VFRectIntl, int)
Fills a rectangular region in an RGB24 image with a solid color.
public static void FillColor(nint inPixels, int inWidth, int inHeight, VFRectIntl area, int color)Parameters
inPixelsnint-
Pointer to image pixel data (RGB24 format: 3 bytes per pixel, BGR order). Image is modified in-place.
inWidthint-
Width of entire image in pixels
inHeightint-
Height of entire image in pixels
areaVFRectIntl-
Rectangle defining the region to fill (Left, Top, Right, Bottom coordinates)
colorint-
Fill color as COLORREF value (0x00BBGGRR format: low byte = Blue, middle = Green, high = Red)
Remarks
Operation: Sets all pixels within the specified rectangle to the given color.
Color Format: COLORREF uses Windows BGR format (0x00BBGGRR):
- Red = (color & 0x0000FF)
- Green = (color & 0x00FF00) >> 8
- Blue = (color & 0xFF0000) >> 16
Common Colors:
- 0x000000: Black
- 0xFFFFFF: White
- 0x0000FF: Red
- 0x00FF00: Green
- 0xFF0000: Blue
Area Clipping: If rectangle extends beyond image bounds, it's automatically clipped to image size.
Use Cases: Drawing solid rectangles, clearing regions, creating color bars, masking areas, adding colored overlays.
Performance: Fast memory fill operation using optimized routines.
Native Implementation: Calls FillColor in VisioForge_MFP.dll
FilterBlue(nint, int, int, int, int, bool)
Filters the blue color channel by setting it to 0 if outside specified range, creating selective blue channel filtering.
public static void FilterBlue(nint srcPixels, int srcWidth, int srcHeight, int min, int max, bool smartMultithreading = true)Parameters
srcPixelsnint-
Pointer to image pixel data (RGB24 format: 3 bytes per pixel, BGR order). Image is modified in-place.
srcWidthint-
Width of image in pixels
srcHeightint-
Height of image in pixels
minint-
Minimum blue value to keep (0-255). Blue values below this become 0.
maxint-
Maximum blue value to keep (0-255). Blue values above this become 0.
smartMultithreadingbool-
if set to
true, uses parallel processing for images > 200x200 pixels
Remarks
Effect Description: Selectively removes blue channel values outside the [min, max] range, keeping red and green unchanged.
Algorithm: For each pixel, if blue < min OR blue > max, set blue to 0.
Use Cases: Blue screen removal, color key effects, selective color filtering, artistic color manipulation.
Example: FilterBlue(pixels, w, h, 100, 255) removes dark blue tones, keeping only bright blues.
Native Implementation: Calls EffectFilterBlue in VisioForge_MFP.dll
FilterGreen(nint, int, int, int, int, bool)
Filters the green color channel by setting it to 0 if outside specified range, creating selective green channel filtering.
public static void FilterGreen(nint srcPixels, int srcWidth, int srcHeight, int min, int max, bool smartMultithreading = true)Parameters
srcPixelsnint-
Pointer to image pixel data (RGB24 format: 3 bytes per pixel, BGR order). Image is modified in-place.
srcWidthint-
Width of image in pixels
srcHeightint-
Height of image in pixels
minint-
Minimum green value to keep (0-255). Green values below this become 0.
maxint-
Maximum green value to keep (0-255). Green values above this become 0.
smartMultithreadingbool-
if set to
true, uses parallel processing for images > 200x200 pixels
Remarks
Effect Description: Selectively removes green channel values outside the [min, max] range, keeping red and blue unchanged.
Algorithm: For each pixel, if green < min OR green > max, set green to 0.
Use Cases: Green screen removal, chroma key effects, vegetation filtering, color-based masking.
Example: FilterGreen(pixels, w, h, 128, 255) removes dark greens, keeping only bright greens.
Native Implementation: Calls EffectFilterGreen in VisioForge_MFP.dll
FilterRed(nint, int, int, int, int, bool)
Filters the red color channel by setting it to 0 if outside specified range, creating selective red channel filtering.
public static void FilterRed(nint srcPixels, int srcWidth, int srcHeight, int min, int max, bool smartMultithreading = true)Parameters
srcPixelsnint-
Pointer to image pixel data (RGB24 format: 3 bytes per pixel, BGR order). Image is modified in-place.
srcWidthint-
Width of image in pixels
srcHeightint-
Height of image in pixels
minint-
Minimum red value to keep (0-255). Red values below this become 0.
maxint-
Maximum red value to keep (0-255). Red values above this become 0.
smartMultithreadingbool-
if set to
true, uses parallel processing for images > 200x200 pixels
Remarks
Effect Description: Selectively removes red channel values outside the [min, max] range, keeping green and blue unchanged.
Algorithm: For each pixel, if red < min OR red > max, set red to 0.
Use Cases: Color correction, selective color removal, artistic effects, color-based object isolation.
Example: FilterRed(pixels, w, h, 200, 255) removes dark reds, keeping only bright reds.
Native Implementation: Calls EffectFilterRed in VisioForge_MFP.dll
FlipHorizontalRGB24(nint, int, int)
Flips an RGB24 image horizontally (mirror left-to-right) in-place.
public static void FlipHorizontalRGB24(nint pixels, int width, int height)Parameters
pixelsnint-
Pointer to image pixel data (RGB24 format: 3 bytes per pixel, BGR order). Image is flipped in-place.
widthint-
Width of image in pixels
heightint-
Height of image in pixels
Remarks
Effect: Mirrors the image along the vertical axis (left side becomes right side and vice versa).
In-Place: Modifies source buffer directly by swapping pixels, no additional memory required.
Use Cases: Mirror/flip camera feed, correct horizontally flipped images, create reflection effects.
Performance: Fast operation using optimized memory swapping.
Native Implementation: Calls FlipHorizontalRGB24 in VisioForge_MFP.dll
FlipHorizontalRGB32(nint, int, int)
Flips an RGB32/ARGB image horizontally (mirror left-to-right) in-place.
public static void FlipHorizontalRGB32(nint pixels, int width, int height)Parameters
pixelsnint-
Pointer to image pixel data (RGB32/ARGB format: 4 bytes per pixel, BGRA order). Image is flipped in-place.
widthint-
Width of image in pixels
heightint-
Height of image in pixels
Remarks
Effect: Mirrors the image along the vertical axis (left side becomes right side and vice versa).
In-Place: Modifies source buffer directly by swapping pixels, no additional memory required.
Alpha Channel: Preserved during flipping - alpha values follow their pixels.
Use Cases: Mirror camera feed, correct horizontally flipped images, create reflection effects with transparency.
Performance: Fast operation using optimized 32-bit pixel swapping.
Related: See VisioForge.Core.FastImageProcessing.FlipHorizontalRGB24(System.IntPtr,System.Int32,System.Int32) for RGB24 format, VisioForge.Core.FastImageProcessing.FlipVerticalRGB32(System.IntPtr,System.Int32,System.Int32) for vertical flipping.
Native Implementation: Calls FlipHorizontalRGB32 in VisioForge_MFP.dll
FlipVerticalRGB24(nint, int, int)
Flips an RGB24 image vertically (upside-down) in-place.
public static void FlipVerticalRGB24(nint pixels, int width, int height)Parameters
pixelsnint-
Pointer to image pixel data (RGB24 format: 3 bytes per pixel, BGR order). Image is flipped in-place.
widthint-
Width of image in pixels
heightint-
Height of image in pixels
Remarks
Effect: Mirrors the image along the horizontal axis (top becomes bottom and vice versa).
In-Place: Modifies source buffer by swapping scan lines, no additional memory required.
Use Cases: Correct upside-down images, flip video vertically, convert between top-down and bottom-up bitmap formats.
Common Scenario: Converting between Windows DIB (bottom-up) and standard image formats (top-down).
Native Implementation: Calls FlipVerticalRGB24 in VisioForge_MFP.dll
FlipVerticalRGB32(nint, int, int)
Flips an RGB32/ARGB image vertically (upside-down) in-place.
public static void FlipVerticalRGB32(nint pixels, int width, int height)Parameters
pixelsnint-
Pointer to image pixel data (RGB32/ARGB format: 4 bytes per pixel, BGRA order). Image is flipped in-place.
widthint-
Width of image in pixels
heightint-
Height of image in pixels
Remarks
Effect: Mirrors the image along the horizontal axis (top becomes bottom and vice versa).
In-Place: Modifies source buffer by swapping scan lines, no additional memory required.
Alpha Channel: Preserved during flipping - alpha values stay with their pixels.
Use Cases: Correct upside-down images, flip video vertically, convert between top-down and bottom-up formats.
Common Scenario: Converting between Windows DIB (bottom-up) and standard ARGB formats (top-down).
Performance: Efficient scan line swapping with 32-bit pixels (4 bytes at a time).
Related: See VisioForge.Core.FastImageProcessing.FlipVerticalRGB24(System.IntPtr,System.Int32,System.Int32) for RGB24 format, VisioForge.Core.FastImageProcessing.FlipHorizontalRGB32(System.IntPtr,System.Int32,System.Int32) for horizontal flipping.
Native Implementation: Calls FlipVerticalRGB32 in VisioForge_MFP.dll
Green(nint, int, int, bool)
Applies a green color filter effect to an RGB24 image, removing red and blue color channels.
public static void Green(nint srcPixels, int srcWidth, int srcHeight, bool smartMultithreading = true)Parameters
srcPixelsnint-
Pointer to image pixel data (RGB24 format: 3 bytes per pixel, BGR order). Image is modified in-place.
srcWidthint-
Width of image in pixels
srcHeightint-
Height of image in pixels
smartMultithreadingbool-
if set to
true, uses parallel processing for images > 200x200 pixels
Remarks
Effect Description: Keeps only the green channel, sets red and blue to 0, creating a green-tinted monochrome effect.
Pixel Transformation: For each pixel: R=0, G=unchanged, B=0
Visual Result: Similar to night vision or infrared imaging appearance.
Native Implementation: Calls EffectGreen in VisioForge_MFP.dll (C++ VideoEffects.cpp)
Greyscale(nint, int, int, nint)
Converts an RGB24 color image to greyscale using Intel IPP luminance formula.
public static void Greyscale(nint srcPixels, int srcWidth, int srcHeight, nint temp)Parameters
srcPixelsnint-
Pointer to image pixel data (RGB24 format: 3 bytes per pixel, BGR order). Image is modified in-place.
srcWidthint-
Width of image in pixels
srcHeightint-
Height of image in pixels
tempnint-
Pointer to temporary working buffer. Must be at least width * height bytes (for single-channel greyscale intermediate).
Remarks
Luminance Formula: Uses ITU-R BT.601 standard: Y = 0.299*R + 0.587*G + 0.114*B
Algorithm:
- Converts RGB to single-channel greyscale using weighted luminance
- Duplicates greyscale value across all three RGB channels (R=G=B=greyscale)
- Result is RGB24 image where each pixel has equal R, G, B values
Intel IPP Acceleration: Uses ippiColorToGray_8u_C3C1R and ippiDup_8u_C1C3R for optimized SIMD processing.
Temporary Buffer: Required for intermediate single-channel greyscale data before duplicating to RGB channels.
Native Implementation: Calls EffectGreyscale in VisioForge_MFP.dll (C++ VideoEffects_IPP.cpp: IPPGreyscale function)
ImageCutRGB24(nint, int, int, nint, int, int)
Extracts a sub-region from an RGB24 source image starting at specified coordinates and copies it to output buffer.
public static void ImageCutRGB24(nint srcPixels, int srcWidth, int srcHeight, nint destPixels, int cutX, int cutY)Parameters
srcPixelsnint-
Pointer to source image pixel data (RGB24 format: 3 bytes per pixel, BGR order)
srcWidthint-
Width of source image in pixels
srcHeightint-
Height of source image in pixels
destPixelsnint-
Pointer to output buffer where extracted region will be written (RGB24 format)
cutXint-
X coordinate (column) in source image where extraction starts (0-based)
cutYint-
Y coordinate (row) in source image where extraction starts (0-based)
Remarks
Operation: Copies the portion of source image from (cutX, cutY) to (srcWidth-1, srcHeight-1) into output buffer.
Extracted Size: Width = srcWidth - cutX, Height = srcHeight - cutY
Output Buffer Size: Must be at least (srcWidth - cutX) * (srcHeight - cutY) * 3 bytes.
Use Cases: Removing top-left border/margin, extracting bottom-right portion, simple cropping from fixed position.
Difference from Crop: ImageCut extracts from (cutX, cutY) to image end. Crop extracts arbitrary rectangle.
Example: ImageCutRGB24(img, 640, 480, out, 10, 20) extracts 630×460 region starting at (10, 20).
Bounds: cutX must be < srcWidth, cutY must be < srcHeight, otherwise results are undefined.
Related: See VisioForge.Core.FastImageProcessing.Crop24(System.IntPtr,System.UInt32,System.UInt32,System.IntPtr,VisioForge.Core.Types.VFRectIntl) for extracting arbitrary rectangles, VisioForge.Core.FastImageProcessing.ImageCutRGB32(System.IntPtr,System.Int32,System.Int32,System.IntPtr,System.Int32,System.Int32) for RGB32 format.
Native Implementation: Calls ImageCutRGB24 in VisioForge_MFP.dll
ImageCutRGB32(nint, int, int, nint, int, int)
Extracts a sub-region from an RGB32/ARGB source image starting at specified coordinates and copies it to output buffer.
public static void ImageCutRGB32(nint srcPixels, int srcWidth, int srcHeight, nint destPixels, int cutX, int cutY)Parameters
srcPixelsnint-
Pointer to source image pixel data (RGB32/ARGB format: 4 bytes per pixel, BGRA order)
srcWidthint-
Width of source image in pixels
srcHeightint-
Height of source image in pixels
destPixelsnint-
Pointer to output buffer where extracted region will be written (RGB32/ARGB format)
cutXint-
X coordinate (column) in source image where extraction starts (0-based)
cutYint-
Y coordinate (row) in source image where extraction starts (0-based)
Remarks
Operation: Copies the portion of source image from (cutX, cutY) to (srcWidth-1, srcHeight-1) into output buffer.
Extracted Size: Width = srcWidth - cutX, Height = srcHeight - cutY
Output Buffer Size: Must be at least (srcWidth - cutX) * (srcHeight - cutY) * 4 bytes.
Alpha Channel: Preserved from source to destination.
Use Cases: Removing margins, extracting portions, simple single-parameter cropping.
Difference from Crop: ImageCut extracts from (cutX, cutY) to image end. Crop32 extracts arbitrary rectangle.
Example: ImageCutRGB32(img, 800, 600, out, 50, 100) extracts 750×500 region starting at (50, 100).
Bounds: cutX must be < srcWidth, cutY must be < srcHeight, otherwise results are undefined.
Related: See VisioForge.Core.FastImageProcessing.Crop32(System.IntPtr,System.UInt32,System.UInt32,System.IntPtr,VisioForge.Core.Types.VFRectIntl) for extracting arbitrary rectangles, VisioForge.Core.FastImageProcessing.ImageCutRGB24(System.IntPtr,System.Int32,System.Int32,System.IntPtr,System.Int32,System.Int32) for RGB24 format.
Native Implementation: Calls ImageCutRGB32 in VisioForge_MFP.dll
Init()
Initializes the Fast Image Processing library by loading the appropriate native DLL (x86 or x64).
public static void Init()Remarks
This method must be called before using any other methods in this class. It attempts to load and initialize the platform-specific native library:
- On 32-bit processes: VisioForge_MFP.dll
- On 64-bit processes: VisioForge_MFP64.dll
If initialization fails, all subsequent operations will fail. Use VisioForge.Core.FastImageProcessing.IsFound to check if initialization was successful.
Invert(nint, int, int, nint)
Inverts all colors in an RGB24 image, creating a photographic negative effect.
public static void Invert(nint srcPixels, int srcWidth, int srcHeight, nint temp)Parameters
srcPixelsnint-
Pointer to image pixel data (RGB24 format: 3 bytes per pixel, BGR order). Image is modified in-place.
srcWidthint-
Width of image in pixels
srcHeightint-
Height of image in pixels
tempnint-
Pointer to temporary working buffer. Must be at least width * height * 3 bytes.
Remarks
Effect Description: Inverts each color channel by subtracting from 255, creating a negative image effect.
Algorithm: For each pixel: newR = 255 - R, newG = 255 - G, newB = 255 - B
Visual Result: Dark areas become light, light areas become dark; colors become their complements (red↔cyan, green↔magenta, blue↔yellow).
Use Cases: Photographic negative simulation, artistic effects, improving visibility of certain image features.
Property: Applying invert twice returns to original image (it's its own inverse operation).
Native Implementation: Calls EffectInvert in VisioForge_MFP.dll
IsFound()
Checks if the Fast Image Processing library was successfully initialized.
public static bool IsFound()Returns
- bool
-
trueif the native library is loaded and ready to use; otherwise,false.
Remarks
Always check this before using any image processing methods. If this returns false, the native DLL could not be loaded (missing file, wrong architecture, or missing dependencies).
JPEGDataDecodeToRGB(nint, int, nint, int, bool)
Decodes JPEG data from memory buffer into raw RGB pixel data.
public static int JPEGDataDecodeToRGB(nint source, int sourceSize, nint output, int outputSize, bool bgr)Parameters
sourcenint-
Pointer to JPEG-compressed data in memory
sourceSizeint-
Size of JPEG data in bytes
outputnint-
Pointer to output buffer where decoded RGB pixels will be written
outputSizeint-
Size of output buffer in bytes. Must be at least width * height * 3 for RGB24.
bgrbool-
if set to
true, outputs BGR byte order (Blue, Green, Red); otherwise RGB byte order (Red, Green, Blue)
Returns
- int
-
- Positive value: Number of bytes written to output buffer (width * height * 3)
- 0 or negative: Error occurred during decoding
Remarks
Memory-to-Memory Decoding: Unlike VisioForge.Core.FastImageProcessing.JPEGFileDecodeToRGB(System.String,System.IntPtr,System.Int32,System.Boolean), this decodes from memory buffer instead of file.
Use Cases: Decoding JPEG from network stream, embedded JPEG in file container, JPEG from database, in-memory processing.
Buffer Requirements: Output buffer size depends on decoded image dimensions. Decode header first or allocate large buffer.
Output Format: Always produces 24-bit RGB (3 bytes per pixel) regardless of source JPEG format.
BGR Parameter:
- True: Outputs BGR order (compatible with Windows DIB, GDI+, DirectShow)
- False: Outputs RGB order (compatible with OpenGL, standard image formats)
Performance: Uses libjpeg-turbo with SIMD acceleration for fast decoding.
Related: Use VisioForge.Core.FastImageProcessing.JPEGFileDecodeToRGB(System.String,System.IntPtr,System.Int32,System.Boolean) to decode from file, VisioForge.Core.FastImageProcessing.JPEGDataEncodeFromRGB(System.IntPtr,System.Int32,System.Int32,System.Int32,System.Int32,System.IntPtr,System.Int32@,System.Boolean) to encode to memory.
Native Implementation: Calls JPEGDataDecodeToRGB in VisioForge_MFP.dll (libjpeg-turbo wrapper)
JPEGDataEncodeFromRGB(nint, int, int, int, int, nint, out int, bool)
Encodes raw RGB pixel data to JPEG format in memory buffer with specified quality level.
public static int JPEGDataEncodeFromRGB(nint source, int sourceSize, int quality, int width, int height, nint output, out int outputSize, bool bgr)Parameters
sourcenint-
Pointer to source RGB pixel data buffer
sourceSizeint-
Size of source buffer in bytes (should be width * height * 3 for RGB24)
qualityint-
JPEG compression quality (1-100). Higher = better quality, larger output. Typical range: 75-95.
widthint-
Image width in pixels
heightint-
Image height in pixels
outputnint-
Pointer to output buffer where JPEG data will be written. Must be pre-allocated.
outputSizeint-
Output parameter: Returns actual size of encoded JPEG data in bytes.
bgrbool-
if set to
true, source is BGR byte order; otherwise RGB byte order
Returns
- int
-
- 0: Success, JPEG data created in output buffer
- Non-zero: Error occurred during encoding
Remarks
Memory-to-Memory Encoding: Unlike VisioForge.Core.FastImageProcessing.JPEGFileEncodeFromRGB(System.String,System.Int32,System.IntPtr,System.Int32,System.Int32,System.Int32,System.Boolean), this encodes to memory buffer instead of file.
Use Cases: Encoding for network transmission, storing in databases, embedding in file containers, in-memory processing pipelines.
Output Buffer Size:
- Worst case: Allocate width * height * 3 bytes (uncompressed size)
- Typical: 5-20% of uncompressed size depending on quality and content
- Actual size returned in outputSize parameter after encoding
Quality Parameter:
- 1-50: High compression, small size, visible artifacts
- 75-85: Recommended balance of quality and size
- 90-100: Maximum quality, large size, minimal compression
Performance: Uses libjpeg-turbo with SIMD acceleration. Faster than file I/O version.
Color Space: RGB input is automatically converted to YCbCr (JPEG's native color space).
Related: Use VisioForge.Core.FastImageProcessing.JPEGFileEncodeFromRGB(System.String,System.Int32,System.IntPtr,System.Int32,System.Int32,System.Int32,System.Boolean) to encode to file, VisioForge.Core.FastImageProcessing.JPEGDataDecodeToRGB(System.IntPtr,System.Int32,System.IntPtr,System.Int32,System.Boolean) to decode from memory.
Native Implementation: Calls JPEGDataEncodeFromRGB in VisioForge_MFP.dll (libjpeg-turbo wrapper)
JPEGFileDecodeToRGB(string, nint, int, bool)
Decodes a JPEG file from disk into raw RGB pixel data.
public static int JPEGFileDecodeToRGB(string source, nint output, int outputSize, bool bgr)Parameters
sourcestring-
Full path to JPEG file on disk
outputnint-
Pointer to output buffer where decoded RGB pixels will be written
outputSizeint-
Size of output buffer in bytes. Must be at least width * height * 3 for RGB24.
bgrbool-
if set to
true, outputs BGR byte order (Blue, Green, Red); otherwise RGB byte order (Red, Green, Blue)
Returns
- int
-
- Positive value: Number of bytes written to output buffer (width * height * 3)
- 0 or negative: Error occurred during decoding
Remarks
JPEG Decoding: Uses libjpeg-turbo library for fast, hardware-accelerated JPEG decompression.
Output Format: Always produces 24-bit RGB (3 bytes per pixel) regardless of source JPEG format.
BGR Parameter:
- True: Outputs BGR order (compatible with Windows DIB, GDI+, most video APIs)
- False: Outputs RGB order (compatible with OpenGL, some image libraries)
Buffer Size: Caller must allocate output buffer. To determine size, use image dimensions: width * height * 3 bytes.
Performance: Uses SIMD acceleration (SSE2/AVX2) when available for fast decoding.
Supported Formats: Standard JPEG/JFIF, progressive JPEG, grayscale JPEG.
Native Implementation: Calls JPEGFileDecodeToRGB in VisioForge_MFP.dll (libjpeg-turbo wrapper)
JPEGFileEncodeFromRGB(string, int, nint, int, int, int, bool)
Encodes raw RGB pixel data to a JPEG file on disk with specified quality level.
public static int JPEGFileEncodeFromRGB(string filename, int quality, nint source, int sourceSize, int width, int height, bool bgr)Parameters
filenamestring-
Full path where JPEG file will be saved (Unicode/wide character path)
qualityint-
JPEG compression quality (1-100). Higher = better quality, larger file. Typical range: 75-95.
sourcenint-
Pointer to source RGB pixel data buffer
sourceSizeint-
Size of source buffer in bytes (should be width * height * 3 for RGB24)
widthint-
Image width in pixels
heightint-
Image height in pixels
bgrbool-
if set to
true, source is BGR byte order; otherwise RGB byte order
Returns
- int
-
- 0: Success, JPEG file created
- Non-zero: Error occurred during encoding or file writing
Remarks
JPEG Encoding: Uses libjpeg-turbo library for fast, hardware-accelerated JPEG compression.
Quality Parameter:
- 1-50: Low quality, high compression, small file (not recommended)
- 50-75: Medium quality, good compression (acceptable for thumbnails)
- 75-90: High quality, moderate compression (recommended for most uses)
- 90-100: Maximum quality, minimal compression, large file (archival quality)
File Format: Creates standard JFIF JPEG files compatible with all image viewers and editors.
Color Space: RGB input is converted to YCbCr (JPEG's native color space) during encoding.
Performance: Uses SIMD acceleration for fast encoding. Encoding speed depends on quality setting.
File Overwrite: Overwrites existing file without warning if filename already exists.
Native Implementation: Calls JPEGFileEncodeFromRGB in VisioForge_MFP.dll (libjpeg-turbo wrapper)
Marble(nint, int, int, double, int)
Applies a marble texture effect to an RGB24 image using Perlin noise and turbulence.
public static void Marble(nint srcPixels, int width, int height, double scale, int turbulence)Parameters
srcPixelsnint-
Pointer to image pixel data (RGB24 format: 3 bytes per pixel, BGR order). Image is modified in-place.
widthint-
Width of image in pixels
heightint-
Height of image in pixels
scaledouble-
Scale factor for marble pattern (0.1-10.0). Larger values create larger, smoother marble veins.
turbulenceint-
Turbulence amount (0-100). Higher values create more chaotic, detailed marble patterns.
Remarks
Effect Description: Generates organic marble-like veining patterns using Perlin noise combined with the original image colors.
Algorithm: Uses multi-octave Perlin noise with turbulence to create swirling patterns that blend with source colors.
Scale Parameter:
- 0.1-1.0: Fine, detailed marble veins
- 1.0-5.0: Medium-scale marble patterns (realistic)
- 5.0-10.0: Large, sweeping marble features
Turbulence Parameter:
- 0-30: Smooth, gentle marble flows
- 30-70: Moderate turbulence, realistic marble
- 70-100: High turbulence, chaotic artistic patterns
Use Cases: Artistic effects, texture generation, background patterns, simulating natural stone materials.
Native Implementation: Calls EffectMarble in VisioForge_MFP.dll
MirrorDown(nint, int, int, nint)
Mirrors the bottom half of an RGB24 image onto the top half, creating a symmetrical effect using Intel IPP.
public static void MirrorDown(nint srcPixels, int width, int height, nint tempData)Parameters
srcPixelsnint-
Pointer to image pixel data (RGB24 format: 3 bytes per pixel, BGR order). Image is modified in-place.
widthint-
Width of image in pixels
heightint-
Height of image in pixels
tempDatanint-
Pointer to temporary working buffer. Must be at least (width * height * 3) / 2 bytes (half image size).
Remarks
Effect Description: Takes the bottom half of the image, flips it vertically, and replaces the top half with this mirrored copy.
Algorithm:
- Mirrors entire image vertically (flips upside down using Intel IPP)
- Copies top half to temporary buffer
- Mirrors the copied top half vertically again
- Replaces bottom half with the processed data
Visual Result: Creates a perfectly symmetrical image with a horizontal mirror axis in the center.
Symmetry Axis: The middle horizontal line becomes the axis of symmetry.
Use Cases: Artistic symmetry effects, kaleidoscope-like patterns, creating mirrored compositions, reflection effects.
Related: See VisioForge.Core.FastImageProcessing.MirrorRight(System.IntPtr,System.Int32,System.Int32) for vertical axis mirroring (left/right instead of top/bottom).
Temporary Buffer: Required for intermediate storage during mirroring operation (half the image size).
Performance: Uses Intel IPP ippiMirror_8u_C3IR for optimized SIMD mirroring.
Native Implementation: Calls EffectMirrorDownEx in VisioForge_MFP.dll (C++ VideoEffects_IPP.cpp: IPPMirrorDown function)
MirrorRight(nint, int, int)
Mirrors the right half of an RGB24 image onto the left half, creating a symmetrical effect.
public static void MirrorRight(nint srcPixels, int width, int height)Parameters
srcPixelsnint-
Pointer to image pixel data (RGB24 format: 3 bytes per pixel, BGR order). Image is modified in-place.
widthint-
Width of image in pixels
heightint-
Height of image in pixels
Remarks
Effect Description: Takes the right half of the image, flips it horizontally, and replaces the left half with this mirrored copy.
Algorithm: For each row, copies pixels from right half to left half in reverse order, creating vertical axis symmetry.
Visual Result: Creates a perfectly symmetrical image with a vertical mirror axis in the center.
Use Cases: Artistic symmetry effects, kaleidoscope-like patterns, creating mirrored compositions.
Related: See VisioForge.Core.FastImageProcessing.MirrorDown(System.IntPtr,System.Int32,System.Int32,System.IntPtr) for horizontal axis mirroring (top/bottom instead of left/right).
Native Implementation: Calls EffectMirrorRight in VisioForge_MFP.dll
MonoNoise(nint, int, int, int, bool)
Adds random monochrome (grayscale) noise to an RGB24 image, creating a film grain effect.
public static void MonoNoise(nint srcPixels, int srcWidth, int srcHeight, int amount, bool smartMultithreading = true)Parameters
srcPixelsnint-
Pointer to image pixel data (RGB24 format: 3 bytes per pixel, BGR order). Image is modified in-place.
srcWidthint-
Width of image in pixels
srcHeightint-
Height of image in pixels
amountint-
Intensity of noise effect (0-255). Higher values = more visible noise.
smartMultithreadingbool-
if set to
true, uses parallel processing for images > 200x200 pixels
Remarks
Effect Description: Adds the same random value to all three RGB channels of each pixel, creating grayscale speckles.
Difference from ColorNoise: MonoNoise adds identical noise to R, G, and B, producing grayscale grain. ColorNoise adds different noise to each channel, producing colored speckles.
Amount Parameter: Controls the maximum random deviation (0 = no effect, 255 = maximum noise).
Use Cases: Film grain simulation, analog photography effects, vintage video look, noise addition for testing denoisers.
Visual Result: Similar to photographic film grain or old TV static in grayscale.
Native Implementation: Calls EffectMonoNoise in VisioForge_MFP.dll
Mosaic(nint, int, int, int)
Applies a mosaic (pixelation) effect to an RGB24 image by averaging color blocks.
public static void Mosaic(nint srcPixels, int width, int height, int size)Parameters
srcPixelsnint-
Pointer to image pixel data (RGB24 format: 3 bytes per pixel, BGR order). Image is modified in-place.
widthint-
Width of image in pixels
heightint-
Height of image in pixels
sizeint-
Size of mosaic blocks in pixels (1-100). Larger values create bigger blocks and stronger pixelation.
Remarks
Effect Description: Divides image into square blocks and sets all pixels in each block to the average color of that block.
Algorithm: For each size×size block, calculates average RGB values and fills the entire block with this average color.
Size Parameter:
- 1-5: Subtle pixelation, retains most detail
- 5-15: Moderate mosaic effect, visible blocks
- 15-50: Strong pixelation, abstract appearance
- 50+: Extreme pixelation, very blocky
Use Cases: Privacy protection (face/license plate obscuring), artistic effects, retro 8-bit game look, censorship.
ROI Version: Use VisioForge.Core.FastImageProcessing.MosaicROI(System.IntPtr,System.Int32,System.Int32,System.Int32,VisioForge.Core.Types.VFRectIntl) to apply mosaic to specific rectangular region only.
Native Implementation: Calls EffectMosaic in VisioForge_MFP.dll
MosaicROI(nint, int, int, int, VFRectIntl)
Applies a mosaic (pixelation) effect to a specific rectangular region of an RGB24 image.
public static void MosaicROI(nint srcPixels, int width, int height, int size, VFRectIntl rect)Parameters
srcPixelsnint-
Pointer to image pixel data (RGB24 format: 3 bytes per pixel, BGR order). Image is modified in-place.
widthint-
Width of entire image in pixels
heightint-
Height of entire image in pixels
sizeint-
Size of mosaic blocks in pixels (1-100). Larger values create bigger blocks.
rectVFRectIntl-
Rectangle defining the region to apply mosaic effect (ROI - Region Of Interest)
Remarks
Effect Description: Same as VisioForge.Core.FastImageProcessing.Mosaic(System.IntPtr,System.Int32,System.Int32,System.Int32) but only affects pixels within the specified rectangle, leaving rest of image unchanged.
Use Cases: Selective privacy protection (blur specific faces/areas), partial censorship, targeted artistic effects.
ROI Rectangle: Defines area as (Left, Top, Right, Bottom) or (X, Y, Width, Height) depending on VFRectIntl structure.
Clipping: If rectangle extends beyond image boundaries, it's automatically clipped to image size.
Performance: Faster than full-image mosaic when only small region needs processing.
Native Implementation: Calls EffectMosaicROI in VisioForge_MFP.dll
MotionDetectionBuildMatrix(int, int, int, int, byte[], nint)
Motion detection, build matrix.
public static void MotionDetectionBuildMatrix(int width, int height, int linesX, int linesY, byte[] matrixRes, nint matrix)Parameters
widthint-
The width.
heightint-
The height.
linesXint-
The lines x.
linesYint-
The lines y.
matrixResbyte[]-
The matrix resource.
matrixnint-
The matrix.
MotionDetectionCompareImages(nint, nint, nint, bool, bool, bool, bool, int)
Motion detection, compare images.
public static int MotionDetectionCompareImages(nint pic1, nint pic2, nint matrix, bool compareGreyscale, bool compareRed, bool compareGreen, bool compareBlue, int numPixels)Parameters
pic1nint-
The pic 1.
pic2nint-
The pic 2.
matrixnint-
The matrix.
compareGreyscalebool-
if set to
truecompare greyscale. compareRedbool-
if set to
truecompare red. compareGreenbool-
if set to
truecompare green. compareBluebool-
if set to
truecompare blue. numPixelsint-
The number data.
Returns
- int
-
System.Int32.
MotionDetectionHighlight(nint, nint, int, int, int)
Motion detection, highlight.
public static void MotionDetectionHighlight(nint frame, nint matrix, int numPixels, int color, int chlThreshold)Parameters
framenint-
The frame.
matrixnint-
The matrix.
numPixelsint-
The number data.
colorint-
The color.
chlThresholdint-
The CHL threshold.
PanCreate(ref RAWImage, VideoInterpolationMode)
Creates a reusable pan context for efficient repeated pan/crop operations with smooth interpolation.
public static nint PanCreate(ref RAWImage image, VideoInterpolationMode interpolationMode)Parameters
imageRAWImage-
RAWImage structure describing the image format, dimensions, and stride
interpolationModeVideoInterpolationMode-
Interpolation algorithm to use when scaling during pan (nearest, linear, cubic)
Returns
- nint
-
IntPtr handle to pan context. Must be destroyed with VisioForge.Core.FastImageProcessing.PanDestroy(System.IntPtr) when done.
Remarks
Purpose: Creating a pan context enables smooth animated panning and cropping with Ken Burns-style effects.
Pan vs Zoom:
- Pan: Extracts and scales a rectangular region from source image
- Zoom: Magnifies/shrinks entire image with optional offset
- Pan is better for animated region-of-interest extraction
Usage Pattern:
- Call PanCreate once with image specifications
- Call VisioForge.Core.FastImageProcessing.PanImage(System.IntPtr,VisioForge.Core.Types.RAWImage@,System.Int32,System.Int32,System.Int32,System.Int32,System.Int32,System.Int32,System.Int32,System.Int32,System.Int64,System.Int64,System.Int64) multiple times with animated start/stop positions and times
- Call VisioForge.Core.FastImageProcessing.PanDestroy(System.IntPtr) to free resources when done
Use Cases: Ken Burns effect on still photos, animated slideshows, smooth ROI transitions, cinematic panning.
Native Implementation: Calls PanCreate in VisioForge_MFP.dll
PanDestroy(nint)
Destroys a pan context created by VisioForge.Core.FastImageProcessing.PanCreate(VisioForge.Core.Types.RAWImage@,VisioForge.Core.Types.VideoInterpolationMode) and frees all associated resources.
public static void PanDestroy(nint pan)Parameters
pannint-
IntPtr handle to pan context returned by PanCreate
Remarks
Resource Management: Always call this when done using a pan context to prevent memory leaks.
Safe to Call: Can safely be called with IntPtr.Zero (will be ignored).
After Calling: The pan handle becomes invalid and must not be used in subsequent operations.
Native Implementation: Calls PanDestroy in VisioForge_MFP.dll
PanImage(nint, ref RAWImage, int, int, int, int, int, int, int, int, long, long, long)
Pan effect, process.
public static int PanImage(nint pan, ref RAWImage image, int startX, int startY, int startWidth, int startHeight, int stopX, int stopY, int stopWidth, int stopHeight, long startTime, long stopTime, long currentTime)Parameters
pannint-
The pan.
imageRAWImage-
The image.
startXint-
The start x.
startYint-
The start y.
startWidthint-
The start width.
startHeightint-
The start height.
stopXint-
The stop x.
stopYint-
The stop y.
stopWidthint-
Width of the stop.
stopHeightint-
Height of the stop.
startTimelong-
The start time.
stopTimelong-
The stop time.
currentTimelong-
The current time.
Returns
- int
-
System.Int32.
Posterize(nint, int, int, int)
Applies a posterization effect to an RGB24 image by reducing the number of color levels per channel.
public static void Posterize(nint srcPixels, int width, int height, int amount)Parameters
srcPixelsnint-
Pointer to image pixel data (RGB24 format: 3 bytes per pixel, BGR order). Image is modified in-place.
widthint-
Width of image in pixels
heightint-
Height of image in pixels
amountint-
Number of color levels per channel (2-128). Lower values create more dramatic posterization.
Remarks
Effect Description: Reduces color bit depth by grouping similar colors into discrete levels, creating a poster-like appearance with flat color areas.
Algorithm: Divides the 0-255 range into 'amount' equal steps, rounds each color value to nearest step, reducing total colors to amount³.
Amount Parameter:
- 2-4: Extreme posterization, very few colors (8-64 total), high contrast
- 4-8: Strong posterization, pop art style (64-512 colors)
- 8-16: Moderate posterization, retro digital look (512-4096 colors)
- 16-32: Subtle posterization, slight banding visible (4096-32768 colors)
- 32+: Very subtle, approaching original image quality
Total Colors: With amount=N, total possible colors = N × N × N (N³)
Use Cases: Pop art effects, retro computing aesthetics, reducing file size for indexed color formats, artistic simplification.
Native Implementation: Calls EffectPosterize in VisioForge_MFP.dll
Red(nint, int, int, bool)
Applies a red color filter effect to an RGB24 image, removing green and blue color channels.
public static void Red(nint srcPixels, int srcWidth, int srcHeight, bool smartMultithreading = true)Parameters
srcPixelsnint-
Pointer to image pixel data (RGB24 format: 3 bytes per pixel, BGR order). Image is modified in-place.
srcWidthint-
Width of image in pixels
srcHeightint-
Height of image in pixels
smartMultithreadingbool-
if set to
true, uses parallel processing for images > 200x200 pixels
Remarks
Effect Description: Keeps only the red channel, sets green and blue to 0, creating a red-tinted monochrome effect.
Pixel Transformation: For each pixel: R=unchanged, G=0, B=0
Visual Result: Creates a dramatic red-only image, commonly used for artistic effects or infrared simulation.
Native Implementation: Calls EffectRed in VisioForge_MFP.dll (C++ VideoEffects.cpp)
ResizeCreate(ref RAWImage, ref RAWImage, VideoResizeMode, bool)
Creates a reusable resize context for efficient repeated resizing operations using Intel IPP.
public static nint ResizeCreate(ref RAWImage srcData, ref RAWImage dstData, VideoResizeMode interpolation, bool antialiasing)Parameters
srcDataRAWImage-
Source image specification (width, height, format, stride)
dstDataRAWImage-
Destination image specification (target width, height, format, stride)
interpolationVideoResizeMode-
Interpolation algorithm to use for resizing quality
antialiasingbool-
if set to
true, applies antialiasing filter during downscaling to prevent aliasing artifacts
Returns
- nint
-
IntPtr handle to resize context. Must be destroyed with VisioForge.Core.FastImageProcessing.ResizeDestroy(System.IntPtr) when done.
Remarks
Purpose: Creating a resize context allows Intel IPP to pre-calculate interpolation coefficients,
making subsequent resize operations on same-size images much faster (e.g., video frame processing).
Interpolation Modes:
- Nearest Neighbor: Fastest, lowest quality, good for pixel art
- Linear/Bilinear: Fast, medium quality, good for real-time video
- Cubic/Bicubic: Slower, high quality, good for still images
- Lanczos: Slowest, highest quality, best for archival/professional work
Antialiasing:
- True: Applies low-pass filter before downscaling to prevent Moiré patterns and aliasing
- False: Skip filtering for faster processing (may show aliasing when downscaling)
- Recommended: Enable for downscaling (e.g., 1920x1080 → 640x480), disable for upscaling
Usage Pattern:
- Call ResizeCreate once with source and destination specifications
- Call VisioForge.Core.FastImageProcessing.ResizeRAWImage(System.IntPtr,VisioForge.Core.Types.RAWImage@,VisioForge.Core.Types.RAWImage@) multiple times with same-size images
- Call VisioForge.Core.FastImageProcessing.ResizeDestroy(System.IntPtr) to free resources when done
Performance: Significantly faster than VisioForge.Core.FastImageProcessing.ResizeSimple(VisioForge.Core.Types.RAWImage@,VisioForge.Core.Types.RAWImage@,VisioForge.Core.Types.VideoResizeMode) for repeated operations on same dimensions.
Native Implementation: Calls ResizeCreate in VisioForge_MFP.dll (Intel IPP resize initialization)
ResizeDestroy(nint)
Destroys a resize context created by VisioForge.Core.FastImageProcessing.ResizeCreate(VisioForge.Core.Types.RAWImage@,VisioForge.Core.Types.RAWImage@,VisioForge.Core.Types.VideoResizeMode,System.Boolean) and frees all associated resources.
public static void ResizeDestroy(nint resize)Parameters
resizenint-
IntPtr handle to resize context returned by ResizeCreate
Remarks
Resource Management: Always call this when done using a resize context to prevent memory leaks.
Safe to Call: Can safely be called with IntPtr.Zero (will be ignored).
After Calling: The resize handle becomes invalid and must not be used in subsequent operations.
Native Implementation: Calls ResizeDestroy in VisioForge_MFP.dll (frees Intel IPP resize context)
ResizeRAWImage(nint, ref RAWImage, ref RAWImage)
Resizes the RAW image.
public static int ResizeRAWImage(nint resize, ref RAWImage srcData, ref RAWImage dstData)Parameters
Returns
- int
-
System.Int32.
ResizeSimple(ref RAWImage, ref RAWImage, VideoResizeMode)
Resize.
public static int ResizeSimple(ref RAWImage srcData, ref RAWImage dstData, VideoResizeMode videoResizeMode)Parameters
srcDataRAWImage-
The source data.
dstDataRAWImage-
The destination data.
videoResizeModeVideoResizeMode-
The video resize mode.
Returns
- int
-
System.Int32.
RotateIn(nint, int, int, nint, double, bool, nint, ref int)
Rotates an RGB24 image by arbitrary angle using Intel IPP with optional stretching to fit rotated content.
public static void RotateIn(nint srcPixels, int width, int height, nint tempPixels, double angle, bool stretch, nint workingBuffer, ref int workingBufferSize)Parameters
srcPixelsnint-
Pointer to source image pixel data (RGB24 format: 3 bytes per pixel, BGR order)
widthint-
Width of image in pixels
heightint-
Height of image in pixels
tempPixelsnint-
Pointer to temporary output buffer. Must be same size or larger than source (width * height * 3 bytes minimum)
angledouble-
Rotation angle in degrees (positive = counter-clockwise, negative = clockwise)
stretchbool-
if set to
true, stretches rotated result to fill original dimensions; otherwise, may crop or leave black borders workingBuffernint-
Pointer to working memory buffer for rotation algorithm (can be IntPtr.Zero on first call)
workingBufferSizeint-
Input/Output: Size of working buffer in bytes. On first call with null buffer, returns required size.
Remarks
Rotation Algorithm: Uses Intel IPP's high-quality rotation with interpolation to avoid aliasing artifacts.
Working Buffer Pattern:
- First call: Pass IntPtr.Zero for workingBuffer, method returns required size in workingBufferSize
- Allocate buffer of returned size
- Subsequent calls: Pass allocated buffer pointer and size
Angle Parameter:
- 0°: No rotation
- 90°: Rotate 90° counter-clockwise (portrait to landscape)
- -90° or 270°: Rotate 90° clockwise
- 180°: Flip upside down
- Any value: Arbitrary rotation with interpolation
Stretch Parameter:
- True: Scales rotated result to fit original dimensions (may distort aspect ratio)
- False: Maintains aspect ratio, may show black areas where rotated content doesn't fill frame
Legacy Method: For rotation without cropping, use VisioForge.Core.FastImageProcessing.RotateInNoCrop(System.IntPtr,System.Int32,System.Int32,System.Double,System.Int32) which is newer and simpler.
Native Implementation: Calls RotateIn in VisioForge_MFP.dll (uses Intel IPP ippiRotate functions)
RotateInNoCrop(nint, int, int, double, int)
Rotates an RGB24 image by arbitrary angle in-place without cropping, keeping full rotated frame content using Intel IPP.
public static void RotateInNoCrop(nint srcPixels, int width, int height, double angle, int stride = 0)Parameters
srcPixelsnint-
Pointer to RGB24 pixel buffer (3 bytes per pixel, BGR order). Image is rotated in-place.
widthint-
Frame width in pixels
heightint-
Frame height in pixels
angledouble-
Rotation angle in degrees (positive = counter-clockwise, negative = clockwise). Any value supported.
strideint-
Number of bytes per row. Pass 0 to auto-compute as width * 3 for RGB24.
Remarks
No-Crop Rotation: Unlike VisioForge.Core.FastImageProcessing.RotateIn(System.IntPtr,System.Int32,System.Int32,System.IntPtr,System.Double,System.Boolean,System.IntPtr,System.Int32@), this method preserves the entire rotated content without cropping or black borders.
In-Place Operation: Modifies the source buffer directly. Ensure buffer is large enough for rotated dimensions.
Stride Parameter:
- 0 (recommended): Auto-calculates as width * 3 for RGB24
- Custom value: Use when image has padding/alignment (e.g., aligned to 4-byte boundaries)
Quality: Uses Intel IPP's high-quality interpolation (bicubic or bilinear) for smooth rotation without stair-stepping.
Common Angles:
- 90, -90, 180: Fast optimized paths for orthogonal rotations
- Other angles: Uses high-quality interpolation
Error Handling: Throws detailed exceptions with native error messages if rotation fails.
Native Implementation: Calls IPPRotateNoCrop in VisioForge_MFP.dll (custom Intel IPP wrapper)
Exceptions
- ArgumentNullException
-
Thrown if srcPixels is IntPtr.Zero
- ArgumentOutOfRangeException
-
Thrown if width or height is less than or equal to 0
- InvalidOperationException
-
Thrown if rotation fails, native library not found, or architecture mismatch
Saturation(nint, int, int, int, bool)
Adjusts color saturation of an RGB24 image by increasing or decreasing color intensity while preserving luminance.
public static void Saturation(nint srcPixels, int srcWidth, int srcHeight, int amount, bool smartMultithreading = true)Parameters
srcPixelsnint-
Pointer to image pixel data (RGB24 format: 3 bytes per pixel, BGR order). Image is modified in-place.
srcWidthint-
Width of image in pixels
srcHeightint-
Height of image in pixels
amountint-
Saturation adjustment amount (-255 to +255). Positive = more vivid colors, negative = less vivid (toward grayscale), 0 = no change.
smartMultithreadingbool-
if set to
true, uses parallel processing for images > 200x200 pixels
Remarks
Effect Description: Adjusts the intensity of colors without changing brightness. Increases/decreases the difference between color channels.
Algorithm: Converts RGB to HSL (Hue, Saturation, Lightness), adjusts S component, converts back to RGB.
Amount Parameter:
- -255: Complete desaturation (grayscale image)
- -128 to -50: Significant desaturation (washed out, pastel)
- -50 to 0: Subtle desaturation (muted colors)
- 0: No change
- 0 to +50: Subtle increase (more vivid)
- +50 to +128: Strong increase (highly saturated, vibrant)
- +128 to +255: Extreme saturation (may clip colors, neon-like)
Preservation: Unlike simple color scaling, this maintains perceptual brightness and hue while only changing color intensity.
Use Cases: Color correction, artistic enhancement, creating vintage desaturated look, making colors pop for video.
Native Implementation: Calls EffectSaturation in VisioForge_MFP.dll
ShakeDown(nint, int, int, int)
Applies a vertical shake/distortion effect to an RGB24 image by randomly shifting scan lines vertically.
public static void ShakeDown(nint srcPixels, int width, int height, int factor)Parameters
srcPixelsnint-
Pointer to image pixel data (RGB24 format: 3 bytes per pixel, BGR order). Image is modified in-place.
widthint-
Width of image in pixels
heightint-
Height of image in pixels
factorint-
Shake intensity (1-50). Higher values create more vertical displacement.
Remarks
Effect Description: Randomly shifts horizontal scan lines up or down, creating a distorted/glitch appearance.
Algorithm: For each scan line, randomly shifts it vertically by amount determined by factor, wrapping around at image boundaries.
Factor Parameter:
- 1-10: Subtle shake, slight vertical distortion
- 10-25: Moderate shake, visible glitch effect
- 25-50: Strong shake, heavy distortion/scrambling
Use Cases: VHS glitch effects, digital artifact simulation, creative distortion, motion blur simulation.
Visual Result: Similar to analog video interference or vertical hold problems on old TVs.
Native Implementation: Calls EffectShakeDown in VisioForge_MFP.dll
Sharpen(nint, int, int, nint)
Applies a sharpening filter to an RGB24 image to enhance edges and fine details.
public static void Sharpen(nint srcPixels, int width, int height, nint temp)Parameters
srcPixelsnint-
Pointer to image pixel data (RGB24 format: 3 bytes per pixel, BGR order). Image is modified in-place.
widthint-
Width of image in pixels
heightint-
Height of image in pixels
tempnint-
Pointer to temporary working buffer. Must be at least width * height * 3 bytes.
Remarks
Effect Description: Enhances edges and details by accentuating differences between adjacent pixels using a sharpening kernel.
Algorithm: Uses a convolution kernel that amplifies high-frequency components (edges) while preserving low-frequency (smooth areas).
Typical Kernel: Center weight is positive and large, surrounding pixels are negative, creating edge enhancement.
Use Cases: Improving perceived sharpness of blurry images, enhancing text readability, compensating for soft camera focus.
Side Effects: May amplify noise and compression artifacts along with edges.
Temporary Buffer: Required for intermediate convolution results before writing back to source.
Native Implementation: Calls EffectSharpen in VisioForge_MFP.dll
Solorize(nint, int, int, int, bool)
Applies a solarization effect to an RGB24 image by inverting colors above a threshold, creating a photographic solarization look.
public static void Solorize(nint srcPixels, int srcWidth, int srcHeight, int amount, bool smartMultithreading = true)Parameters
srcPixelsnint-
Pointer to image pixel data (RGB24 format: 3 bytes per pixel, BGR order). Image is modified in-place.
srcWidthint-
Width of image in pixels
srcHeightint-
Height of image in pixels
amountint-
Solarization threshold (0-255). Values above this threshold are inverted.
smartMultithreadingbool-
if set to
true, uses parallel processing for images > 200x200 pixels
Remarks
Effect Description: Inverts color values that exceed the threshold, creating a partial negative effect similar to photographic solarization.
Algorithm: For each color channel: if value > amount, then newValue = 255 - value; else newValue = value
Amount Parameter (Threshold):
- 0-64: Inverts most colors, strong solarization (mostly negative)
- 64-128: Balanced solarization, mix of normal and inverted
- 128-192: Moderate solarization, inverts only bright areas
- 192-255: Subtle solarization, inverts only very bright highlights
Photographic Origin: Named after a darkroom technique where film is briefly exposed to light during development.
Visual Result: Creates surreal metallic tones with inverted highlights, popular in psychedelic and experimental photography.
Use Cases: Artistic effects, retro photography look, experimental imaging, unique color palettes.
Native Implementation: Calls EffectSolorize in VisioForge_MFP.dll
Spray(nint, int, int, int)
Applies a spray paint effect to an RGB24 image by randomly dispersing pixels within local neighborhoods.
public static void Spray(nint srcPixels, int width, int height, int amount)Parameters
srcPixelsnint-
Pointer to image pixel data (RGB24 format: 3 bytes per pixel, BGR order). Image is modified in-place.
widthint-
Width of image in pixels
heightint-
Height of image in pixels
amountint-
Spray radius (1-50). Larger values create more dispersed, scattered appearance.
Remarks
Effect Description: Randomly replaces each pixel with a pixel from its neighborhood, creating a diffused spray paint appearance.
Algorithm: For each pixel, randomly selects another pixel within a radius of 'amount' pixels and copies its color.
Amount Parameter (Spray Radius):
- 1-5: Subtle spray effect, slight pixel dispersion
- 5-15: Moderate spray, visible spray paint look
- 15-30: Strong spray, heavily diffused artistic effect
- 30-50: Extreme spray, very abstract scattered appearance
Visual Result: Simulates the stippled texture of spray paint or airbrush, with colors bleeding and mixing at edges.
Use Cases: Artistic effects, simulating spray paint or watercolor, creating impressionistic looks, graffiti-style rendering.
Randomness: Effect is non-deterministic - running twice produces different results.
Native Implementation: Calls EffectSpray in VisioForge_MFP.dll
ZoomCreate(ref RAWImage, VideoInterpolationMode)
Creates a reusable zoom context for efficient repeated zoom operations on images.
public static nint ZoomCreate(ref RAWImage image, VideoInterpolationMode interpolationMode)Parameters
imageRAWImage-
RAWImage structure describing the image format, dimensions, and stride
interpolationModeVideoInterpolationMode-
Interpolation algorithm to use for zooming quality (nearest, linear, cubic)
Returns
- nint
-
IntPtr handle to zoom context. Must be destroyed with VisioForge.Core.FastImageProcessing.ZoomDestroy(System.IntPtr) when done.
Remarks
Purpose: Creating a zoom context allows pre-calculating interpolation data for efficient repeated zoom operations.
Interpolation Modes:
- Nearest Neighbor: Fastest, blocky appearance when zooming in, good for pixel art
- Linear/Bilinear: Fast, smooth zoom, good for real-time video
- Cubic/Bicubic: Slower, highest quality, best for still images and detailed content
Usage Pattern:
- Call ZoomCreate once with image specifications
- Call VisioForge.Core.FastImageProcessing.ZoomImage(System.IntPtr,VisioForge.Core.Types.RAWImage@,System.Double,System.Double,System.Int32,System.Int32) multiple times with different zoom levels and shifts
- Call VisioForge.Core.FastImageProcessing.ZoomDestroy(System.IntPtr) to free resources when done
Performance: Reusing context is much faster than creating new context for each zoom operation.
Related: See VisioForge.Core.FastImageProcessing.PanCreate(VisioForge.Core.Types.RAWImage@,VisioForge.Core.Types.VideoInterpolationMode) for pan-only operations, VisioForge.Core.FastImageProcessing.ResizeCreate(VisioForge.Core.Types.RAWImage@,VisioForge.Core.Types.RAWImage@,VisioForge.Core.Types.VideoResizeMode,System.Boolean) for pure resizing.
Native Implementation: Calls ZoomCreate in VisioForge_MFP.dll
ZoomDestroy(nint)
Destroys a zoom context created by VisioForge.Core.FastImageProcessing.ZoomCreate(VisioForge.Core.Types.RAWImage@,VisioForge.Core.Types.VideoInterpolationMode) and frees all associated resources.
public static void ZoomDestroy(nint zoom)Parameters
zoomnint-
IntPtr handle to zoom context returned by ZoomCreate
Remarks
Resource Management: Always call this when done using a zoom context to prevent memory leaks.
Safe to Call: Can safely be called with IntPtr.Zero (will be ignored).
After Calling: The zoom handle becomes invalid and must not be used in subsequent operations.
Native Implementation: Calls ZoomDestroy in VisioForge_MFP.dll
ZoomImage(nint, ref RAWImage, double, double, int, int)
Applies zoom and pan transformations to an image using a pre-created zoom context.
public static int ZoomImage(nint zoom, ref RAWImage image, double zoomX, double zoomY, int shiftX, int shiftY)Parameters
zoomnint-
IntPtr handle to zoom context created by VisioForge.Core.FastImageProcessing.ZoomCreate(VisioForge.Core.Types.RAWImage@,VisioForge.Core.Types.VideoInterpolationMode)
imageRAWImage-
RAWImage structure containing source image data and receiving zoomed result (in-place operation)
zoomXdouble-
Horizontal zoom factor (1.0 = no zoom, >1.0 = zoom in/magnify, <1.0 = zoom out/shrink)
zoomYdouble-
Vertical zoom factor (1.0 = no zoom, >1.0 = zoom in/magnify, <1.0 = zoom out/shrink)
shiftXint-
Horizontal pan offset in pixels (positive = shift right, negative = shift left). Applied after zoom.
shiftYint-
Vertical pan offset in pixels (positive = shift down, negative = shift up). Applied after zoom.
Returns
- int
-
0 on success, non-zero on error
Remarks
Zoom + Pan Operation: Applies both zooming and panning in a single optimized operation.
Zoom Factors:
- 1.0: Original size (100%, no zoom)
- 2.0: 2x magnification (zoom in, image appears 2x larger)
- 0.5: 0.5x reduction (zoom out, image appears 2x smaller)
- Different X and Y values: Non-uniform scaling (aspect ratio change)
Pan Offsets:
- Applied after zoom transformation
- Allow viewing different portions of zoomed image
- Useful for digital pan-tilt-zoom (PTZ) camera simulation
Use Cases:
- Digital zoom for cameras without optical zoom
- PTZ simulation (pan-tilt-zoom without mechanical movement)
- Focus on specific image regions
- Ken Burns effect (slow zoom/pan over still images)
- Video stabilization preview
Performance: Efficient when using pre-created zoom context with same image size. Uses interpolation mode specified in ZoomCreate.
Clipping: Areas outside the source image after zoom/pan will show black or undefined data.
Native Implementation: Calls ZoomImage in VisioForge_MFP.dll