Class VideoEffectDeinterlaceTriangle
- Namespace
- VisioForge.Core.Types.VideoEffects
- Assembly
- VisioForge.Core.dll
Represents a triangle-kernel deinterlacing effect that uses triangular weighted filtering to convert interlaced video to progressive format with configurable interpolation strength.
public class VideoEffectDeinterlaceTriangle : VideoEffect, IVideoEffectDeinterlaceTriangle, IVideoEffectInheritance
Implements
Inherited Members
Remarks
Triangle deinterlacing employs a triangular weighting function to interpolate missing scan lines from surrounding lines in interlaced video. The triangle kernel provides smooth, weighted interpolation where closer lines have more influence than distant lines, creating natural-looking progressive output. Unlike simple line doubling or averaging, the triangle kernel produces smoother gradients and better preserves image structure while converting from interlaced to progressive format.
SDK Availability: This effect is available in VideoCaptureCore, MediaPlayerCore, and VideoEditCore SDKs. Windows platform only.
Platform Support: Windows only (requires Windows-specific video processing filters).
The algorithm applies a triangle-shaped weighting kernel vertically across scan lines to reconstruct missing lines from interlaced fields. The VisioForge.Core.Types.VideoEffects.VideoEffectDeinterlaceTriangle.Weight parameter controls the shape and influence of the triangle kernel: lower weights produce sharper interpolation (closer to line doubling), while higher weights create smoother interpolation by incorporating more surrounding lines with gradually decreasing influence. This approach is particularly effective for content with smooth gradients, gentle curves, and diagonal edges where maintaining smooth transitions between lines is important.
Key Features:
- Triangular weighting for smooth, natural interpolation
- Single weight parameter for straightforward configuration
- Excellent for content with gradients and diagonal edges
- Maintains image smoothness while reconstructing missing lines
- Computationally efficient spatial-only deinterlacing
- No temporal buffering required (lower latency than temporal methods)
- Predictable behavior independent of motion characteristics
Common Use Cases:
- Deinterlacing computer-generated or animated content with smooth gradients
- Processing interlaced graphics, titles, or UI elements in video
- Real-time deinterlacing where minimal latency is required (no temporal buffering)
- Content with predominantly diagonal edges or circular shapes
- Scenarios where consistent, predictable deinterlacing behavior is more important than optimal motion handling
- Converting interlaced overlay graphics or subtitles
- Low-complexity deinterlacing on resource-constrained systems
Technical Details: The triangle kernel weights adjacent lines according to a triangular function, where the weight decreases linearly with distance from the line being interpolated. The VisioForge.Core.Types.VideoEffects.VideoEffectDeinterlaceTriangle.Weight parameter (range 0-255) determines the kernel's steepness and the number of surrounding lines that significantly influence the interpolation. A weight of 255 creates a very shallow triangle, incorporating many lines with gradually decreasing weights. A weight near 0 creates a steep triangle, primarily using only immediately adjacent lines. This spatial-only approach means the algorithm doesn't analyze motion or temporal changes, making it deterministic and low-latency but unable to adapt to content characteristics.
Parameter Tuning Guidelines: The default weight of 180 provides a good balance between smoothness and sharpness for most content. Lower weights (100-150) produce sharper results with less vertical blur, suitable for content with fine horizontal details like text or thin lines. Higher weights (200-240) produce smoother results with more vertical blending, ideal for gradients, organic shapes, and content where smoothness is prioritized over sharpness. Very low weights (0-50) approach line doubling behavior. Very high weights (250-255) may over-smooth the image, reducing apparent resolution.
Limitations: Triangle deinterlacing is spatial-only and does not analyze motion or temporal information. This means it will always produce some combing artifacts on moving objects, as it cannot distinguish between static and moving areas. For content with significant motion, motion-adaptive methods like VisioForge.Core.Types.VideoEffects.VideoEffectDeinterlaceCAVT or VisioForge.Core.Types.VideoEffects.VideoEffectDeinterlaceBlend typically produce better quality. However, triangle deinterlacing's simplicity, low latency, and predictable behavior make it valuable for specific use cases, particularly computer-generated content or real-time applications where temporal analysis is impractical.
Comparison with Other Deinterlacing Methods: Triangle deinterlacing is simpler and faster than motion-adaptive methods but produces lower quality on moving content. It typically produces better quality than simple bob or weave deinterlacing, especially on diagonal edges and gradients. The lack of temporal analysis means zero latency from frame buffering, making it suitable for live applications where other methods' buffering delay is unacceptable. Choose triangle deinterlacing when simplicity, low latency, or predictable behavior is more important than optimal motion handling.
For other deinterlacing approaches, see VisioForge.Core.Types.VideoEffects.VideoEffectDeinterlaceCAVT for content-adaptive vertical-temporal filtering with motion detection, or VisioForge.Core.Types.VideoEffects.VideoEffectDeinterlaceBlend for adaptive blending with granular control. Both provide better quality on moving content but require temporal buffering and more computational resources.
Constructors
VideoEffectDeinterlaceTriangle(bool, byte, string, TimeSpan, TimeSpan)
Initializes a new instance of the VisioForge.Core.Types.VideoEffects.VideoEffectDeinterlaceTriangle class with specified parameters.
public VideoEffectDeinterlaceTriangle(bool enabled, byte weight, string name = "DeinterlaceTriangle", TimeSpan startTime = default, TimeSpan stopTime = default)Parameters
enabledbool-
trueto enable the effect immediately;falseto create the effect in a disabled state. The effect can be enabled or disabled later using the VisioForge.Core.Types.VideoEffects.VideoEffect.Enabled property. weightbyte-
The weight value controlling the triangle kernel shape and interpolation smoothness. Valid range is 0-255. Default is 180, providing balanced interpolation suitable for most content. Lower values produce sharper results; higher values produce smoother results.
namestring-
An optional name identifier for this effect instance. Default is "DeinterlaceTriangle". Used to retrieve specific effect instances from a collection via the VisioForge.Core.Types.VideoEffects.VideoEffect.Name property. Multiple effects of the same type can coexist with different names.
startTimeTimeSpan-
The time at which the effect should start being applied. Default is Zero, which applies the effect from the beginning of the video. Use a specific time value to delay the effect start (useful for videos containing both progressive and interlaced sections, or for selectively deinterlacing specific scenes).
stopTimeTimeSpan-
The time at which the effect should stop being applied. Default is Zero, which applies the effect until the end of the video. Set to a specific time to limit the effect duration (useful for processing only interlaced portions of mixed-format video content).
Remarks
If both startTime and stopTime are zero (default),
the effect will be applied for the entire video duration.
Triangle deinterlacing is a spatial-only algorithm that requires no temporal frame buffering, resulting in zero latency from frame delays. This makes it particularly suitable for live or real-time applications where other deinterlacing methods' buffering delays would be problematic. Processing is performed entirely within each frame independently, with no dependency on previous or future frames.
Computational requirements are low compared to motion-adaptive deinterlacing methods. The algorithm performs simple weighted averaging of vertically adjacent lines, making it efficient even on lower-power hardware or when processing high-resolution video. Processing time scales primarily with video resolution and is independent of content characteristics (unlike motion-adaptive methods where processing time may vary with motion complexity).
The default weight of 180 provides good results for general content. Fine-tune this parameter after creation by adjusting the VisioForge.Core.Types.VideoEffects.VideoEffectDeinterlaceTriangle.Weight property based on visual inspection of deinterlaced output, particularly examining diagonal edges, gradients, and fine horizontal details. Consider the nature of your source material: computer-generated content often benefits from different settings than natural video.
Remember that triangle deinterlacing cannot eliminate combing artifacts on moving objects because it does not analyze motion. If motion combing is unacceptable for your application, consider motion-adaptive alternatives like VisioForge.Core.Types.VideoEffects.VideoEffectDeinterlaceCAVT or VisioForge.Core.Types.VideoEffects.VideoEffectDeinterlaceBlend, accepting their higher computational cost and latency.
Properties
Weight
Gets or sets the weight value that controls the triangle kernel shape and interpolation characteristics.
public byte Weight { get; set; }Property Value
Remarks
The weight parameter determines the shape of the triangular weighting function used for interpolation. This controls how many surrounding lines influence the interpolated output and how steeply the weight decreases with distance from the interpolated line. The value essentially trades off between sharpness (using fewer lines with higher weights for nearby lines) and smoothness (using more lines with gradually decreasing weights).
Weight value guidelines:
- 0-50: Very sharp interpolation, approaching line doubling. Minimal vertical blending. Use for content requiring maximum preservation of horizontal detail like text or fine patterns. May produce visible line structure or jaggedness on diagonal edges.
- 50-120: Sharp to moderate interpolation. Good for content with fine details and moderate diagonal edges. Balances sharpness with some smoothness. Suitable for technical content, CAD drawings, or detailed graphics.
- 120-200: Moderate to smooth interpolation (default is 180). Excellent balance for most content types including natural video, computer graphics, and mixed content. Provides smooth gradients while maintaining reasonable sharpness. Recommended starting point for general use.
- 200-240: Smooth to very smooth interpolation. Emphasizes smooth gradients and gentle transitions. Ideal for content with lots of diagonal edges, circular shapes, or smooth gradients like rendered 3D graphics, animated content, or artistic video.
- 240-255: Maximum smoothness. Very soft interpolation that may reduce apparent vertical resolution. Use only for content where smoothness is paramount or for special artistic effects. May appear overly soft on most content.
The optimal weight depends on your content characteristics and quality priorities. Start with the default value of 180, which works well for most content. Decrease the weight if the output appears too soft or blurry vertically, particularly if horizontal details like text are losing clarity. Increase the weight if diagonal edges appear jagged or if gradients show visible banding or stepping.
Note that because triangle deinterlacing is spatial-only, the weight parameter affects overall image smoothness but cannot eliminate combing artifacts on moving objects. If motion artifacts are problematic, consider using a motion-adaptive deinterlacing method instead, regardless of the weight setting.
Methods
GetEffectType()
Gets the specific type of this video effect.
public VideoEffectType GetEffectType()Returns
- VideoEffectType
-
Returns VisioForge.Core.Types.VideoEffects.VideoEffectType.DeinterlaceTriangle to identify this as a triangle deinterlacing effect.
Remarks
This method overrides the base class implementation to provide the concrete effect type. The effect type is used by the video processing pipeline to route the effect to the appropriate triangle deinterlacing filter processor.