Class VideoEffectZoom
- Namespace
- VisioForge.Core.Types.VideoEffects
- Assembly
- VisioForge.Core.dll
Represents a zoom effect that magnifies or reduces the video image with independent horizontal and vertical scaling and positioning control.
public class VideoEffectZoom : VideoEffect, IVideoEffectZoom, IVideoEffectInheritance
Implements
Inherited Members
Remarks
SDK Availability: VideoCaptureCore, MediaPlayerCore, VideoEditCore (Windows only)
Platform Support: Windows only
The zoom effect provides precise control over video scaling and positioning, allowing both magnification (zooming in) and reduction (zooming out) of the video image. It supports independent horizontal and vertical scaling factors, enabling both uniform and non-uniform (anamorphic) zoom operations.
Key features of the zoom effect include:
- Independent X and Y axis zoom control for uniform or anamorphic scaling
- Pixel-precise positioning with horizontal and vertical shift parameters
- Multiple interpolation modes for quality vs. performance optimization
- Real-time processing suitable for both live video and editing workflows
Common use cases include:
- Creating Ken Burns effects (animated zoom and pan) in video editing
- Focusing on specific areas of interest within the frame
- Correcting aspect ratio or cropping video content
- Implementing digital zoom for video surveillance or analysis
- Creating dramatic emphasis or visual storytelling effects
The zoom effect uses interpolation algorithms to maintain image quality when scaling. The quality and performance can be controlled via the VisioForge.Core.Types.VideoEffects.VideoEffectZoom.InterpolationMode property. For animated zoom effects over time, consider combining this effect with the VisioForge.Core.Types.VideoEffects.VideoEffectPan effect.
When zooming in (values > 1.0), areas outside the original frame are cropped. When zooming out (values < 1.0), the image becomes smaller and may require composition with other video layers. The shift parameters allow precise positioning of the zoomed image within the frame.
Constructors
VideoEffectZoom(double, double, int, int, bool, string, TimeSpan, TimeSpan)
Initializes a new instance of the VisioForge.Core.Types.VideoEffects.VideoEffectZoom class with specified zoom and position parameters.
public VideoEffectZoom(double zoomX, double zoomY, int shiftX, int shiftY, bool enabled, string name = "Zoom", TimeSpan startTime = default, TimeSpan stopTime = default)Parameters
zoomXdouble-
The horizontal zoom factor. Use 1.0 for no horizontal zoom, values > 1.0 to zoom in, values < 1.0 to zoom out.
zoomYdouble-
The vertical zoom factor. Use 1.0 for no vertical zoom, values > 1.0 to zoom in, values < 1.0 to zoom out. For uniform scaling, set equal to
zoomX. shiftXint-
The horizontal position offset in pixels. Use 0 for center alignment, positive values to shift right, negative values to shift left.
shiftYint-
The vertical position offset in pixels. Use 0 for center alignment, positive values to shift down, negative values to shift up.
enabledbool-
trueto enable the effect immediately;falseto create the effect in a disabled state. The effect can be enabled later by setting the VisioForge.Core.Types.VideoEffects.VideoEffect.Enabled property. namestring-
An optional name identifier for this effect instance. Default is "Zoom". This name can be used to retrieve and control the effect through the video processing pipeline.
startTimeTimeSpan-
The time at which the effect should start being applied. Default is zero (from beginning). Use Zero to apply the effect from the start of the video.
stopTimeTimeSpan-
The time at which the effect should stop being applied. Default is zero (until end). Use Zero to apply the effect until the end of the video. When both
startTimeandstopTimeare zero, the effect applies throughout the entire video.
Remarks
The zoom effect parameters work together to define the final image transformation:
- Zoom factors determine the magnification level
- Shift parameters control which part of the zoomed image is visible
- Time parameters control when the zoom effect is active
To create animated zoom effects (like Ken Burns effect), you can dynamically modify the zoom and shift properties over time, or combine this effect with the VisioForge.Core.Types.VideoEffects.VideoEffectPan effect.
The VisioForge.Core.Types.VideoEffects.VideoEffectZoom.InterpolationMode property defaults to VisioForge.Core.Types.VideoInterpolationMode.Bilinear but can be changed after construction to optimize for quality or performance based on your needs.
Properties
InterpolationMode
Gets or sets the interpolation algorithm used for scaling the video image.
public VideoInterpolationMode InterpolationMode { get; set; }Property Value
Remarks
The interpolation mode determines how pixel values are calculated when scaling the image, offering different trade-offs between image quality and processing performance:
- VisioForge.Core.Types.VideoInterpolationMode.NearestNeighbor: Fastest, but produces blocky results when zooming in
- VisioForge.Core.Types.VideoInterpolationMode.Bilinear: Good balance of quality and performance (default)
- VisioForge.Core.Types.VideoInterpolationMode.Bicubic: Higher quality, smoother results, more CPU intensive
- VisioForge.Core.Types.VideoInterpolationMode.Lancroz: Highest quality, best for downscaling, most CPU intensive
For real-time video processing or live streaming, VisioForge.Core.Types.VideoInterpolationMode.Bilinear provides an optimal balance. For high-quality video editing and export, consider using VisioForge.Core.Types.VideoInterpolationMode.Bicubic or VisioForge.Core.Types.VideoInterpolationMode.Lancroz.
The quality difference is most noticeable when zooming in significantly (> 2.0x) or when viewing high-resolution content. The performance impact depends on video resolution and system capabilities.
ShiftX
Gets or sets the horizontal position offset in pixels.
public int ShiftX { get; set; }Property Value
Remarks
The horizontal shift moves the zoomed image left or right within the frame:
- 0: Centered horizontally (default)
- Positive values: Shift right
- Negative values: Shift left
This parameter is particularly useful when zooming in to focus on specific regions that are not centered in the frame. Combined with VisioForge.Core.Types.VideoEffects.VideoEffectZoom.ShiftY, it provides pixel-precise control over the visible area after zoom is applied.
The shift is applied after zoom scaling, so larger zoom factors will make the shift appear to move faster. Shift values are in pixels relative to the original unzoomed frame size.
ShiftY
Gets or sets the vertical position offset in pixels.
public int ShiftY { get; set; }Property Value
Remarks
The vertical shift moves the zoomed image up or down within the frame:
- 0: Centered vertically (default)
- Positive values: Shift down
- Negative values: Shift up
This parameter enables precise framing of the region of interest after zoom is applied. Combined with VisioForge.Core.Types.VideoEffects.VideoEffectZoom.ShiftX, it allows full control over which part of the original video is visible in the zoomed output.
The shift is applied after zoom scaling, making it easier to focus on specific areas of the frame. Shift values are in pixels relative to the original unzoomed frame size.
ZoomX
Gets or sets the horizontal zoom factor.
public double ZoomX { get; set; }Property Value
Remarks
The horizontal zoom factor controls the magnification along the X axis:
- 1.0: Original size (no zoom)
- > 1.0: Zoom in (magnify). For example, 2.0 doubles the horizontal size
- < 1.0: Zoom out (reduce). For example, 0.5 halves the horizontal size
When VisioForge.Core.Types.VideoEffects.VideoEffectZoom.ZoomX differs from VisioForge.Core.Types.VideoEffects.VideoEffectZoom.ZoomY, the effect creates anamorphic scaling, which can be used to correct aspect ratios or create deliberate distortion effects.
Values should typically be positive. Very large zoom factors (> 10.0) may cause performance degradation and image quality issues depending on the selected VisioForge.Core.Types.VideoEffects.VideoEffectZoom.InterpolationMode.
ZoomY
Gets or sets the vertical zoom factor.
public double ZoomY { get; set; }Property Value
Remarks
The vertical zoom factor controls the magnification along the Y axis:
- 1.0: Original size (no zoom)
- > 1.0: Zoom in (magnify). For example, 2.0 doubles the vertical size
- < 1.0: Zoom out (reduce). For example, 0.5 halves the vertical size
For uniform scaling, set VisioForge.Core.Types.VideoEffects.VideoEffectZoom.ZoomY equal to VisioForge.Core.Types.VideoEffects.VideoEffectZoom.ZoomX. Different values create anamorphic effects useful for aspect ratio conversion or artistic distortion.
Very large zoom factors (> 10.0) may impact performance and require higher quality interpolation modes to maintain acceptable image quality.
Methods
GetEffectType()
Gets the specific type of this video effect.
public VideoEffectType GetEffectType()Returns
- VideoEffectType
-
Returns VisioForge.Core.Types.VideoEffects.VideoEffectType.Zoom to identify this as a zoom effect.
Remarks
This method is used by the video processing pipeline to route the effect to the appropriate zoom processor, which applies the configured scaling and positioning transformations using the selected interpolation algorithm.