Arithmetic
TD COMPs / TOPs / 2023 – Present
The Arithmetic category extends TouchDesigner’s core scalar operations by introducing explicit, mathematically defined methods for combining and manipulating images. Each component in this collection performs per‐pixel computations that mirror classical arithmetic and statistical concepts — from basic summation and subtraction to more complex measures of central tendency such as mean, median, or mode.
These operators provide a foundation for quantitative image manipulation, enabling workflows that treat images not just as visuals, but as numerical datasets. Whether used to blend, normalize, or consolidate multiple sources, Arithmetic components offer precise and predictable behavior essential for both analytical and creative image processing.
Mean
Multi‐Input Averaging Operator
While the term average is often used generically, the mean defines a specific mathematical approach to averaging — one that determines a central or representative value among multiple inputs. In image processing, mean operations can blend, stabilize, or normalize data across several images, producing smoother transitions and reducing local variance.
The operations provided by this component emphasize different mathematical relationships between pixel values, allowing the user to control how intensities combine across inputs.
-
Arithmetic Mean
Computes the standard average of pixel values, ideal for general blending or smoothing between multiple images.
Defined as the sum of all inputs divided by the number of inputs:
-
Geometric Mean
Calculates the root of the product of all input values, preserving proportional balance between pixels. This method is especially useful for averaging multiplicative data or images with wide dynamic ranges.
Defined as:
-
Harmonic Mean
Emphasizes smaller values, producing results that are less influenced by bright outliers. Commonly used when averaging rates or ratios, it is particularly stable for combining images with inverse intensity relationships.
Defined as:Note: The Harmonic Mean operates only on positive, non‐zero input values. The Epsilon parameter ( ) ensures numerical stability by clamping near‐zero or negative pixel values before division.
By providing these three modes within a single component, the Mean COMP offers precise control over how pixel intensities are unified. It serves as a flexible foundation for tasks such as exposure normalization, temporal blending, multi‐channel compositing, and procedural averaging in both analytical and creative image workflows.
Resources:
Parameters
Operation:
Specifies which type of mean (average) is calculated across the input images:
Arithmetic Mean, Geometric Mean, Harmonic Mean.
Method:
Active only when the Operation parameter is set to Arithmetic Mean.
Determines how the arithmetic average is computed:
Native, which uses TouchDesigner’s Composite TOP Average operand.
Explicit, which manually sums all input images and divides by the total number of inputs. This option ensures precision and consistency in cases where the native Composite TOP produces rounding artifacts or channel discrepancies.
Epsilon:
Active only when the Operation parameter is set to Harmonic Mean.
Defines a small positive constant used to clamp negative or near‐zero input values, preventing instability or division errors during calculation.
Include Alpha:
Toggles whether the alpha channel is included in the mean calculation. When disabled, only RGB channels are processed while the alpha channel is passed through unchanged.
Add Input:
Adds an additional TOP input to be included in the mean calculation.
Remove Input:
Removes the last TOP input of the Mean COMP.
In‐ / Outputs
Inputs 0 – 9 — TOP images to be processed.
Output 0 — TOP calculated mean of the input image.
Updated – 18/10/2025
Median
Multi‐Input Central Tendency Operator
While the mean defines an average based on arithmetic or proportional relationships, the median family of operations determines the central or most representative pixel value from multiple inputs. These operations emphasize stability and resistance to outliers — providing more perceptually consistent results when combining images that contain sharp intensity contrasts, noise, or irregular exposure levels.
The different operations available in this component describe alternative approaches to finding a central value among inputs, each suited to distinct image‐processing goals:
-
Median
Identifies the middle pixel value among all inputs when they are ordered by intensity. Unlike the arithmetic mean, the median is unaffected by extreme values, making it ideal for denoising, temporal filtering, and exposure balancing.
For example, when the data set has an odd number of entries:Or, when the data set has an even number of entries:
-
Mode
Selects the most frequently occurring pixel value among inputs. This emphasizes recurring features or dominant tones, often used when consolidating multiple nearly identical images or pattern repetitions.
A tolerance value ( ) defines the range within which pixel values are considered equivalent.
For example: -
Mid‐Range
Calculates the midpoint between the minimum and maximum pixel values, providing a simple yet fast approximation of the central intensity. While less robust to outliers than the median, it can be useful for quick tone balancing or establishing exposure baselines.
Defined as:
By unifying these three operations into a single framework, the Median COMP offers flexible methods for deriving central or dominant intensity representations across multiple images. It serves as a practical tool for temporal smoothing, noise reduction, mode‐based compositing, and adaptive blending workflows in both analytical and creative contexts.
Resources:
Parameters
Operation:
Specifies which central tendency calculation is performed across the input images:
Median, Mode, Mid‐Range.
Epsilon:
Active only when the Operation parameter is set to Mode.
Defines a tolerance range used to group pixel values considered equivalent when identifying the mode. This prevents instability from minor numerical differences and ensures smoother mode estimation across floating‐point data.
Include Alpha:
Toggles whether the alpha channel is included in the central tendency calculation. When disabled, only RGB channels are processed while the alpha channel is passed through unchanged.
Add Input:
Adds an additional TOP input to be included in the tendency calculation.
Remove Input:
Removes the last TOP input of the Median COMP.
In‐ / Outputs
Inputs 0 – 9 — TOP images to be processed.
Output 0 — TOP calculated central tendency of the input image.
Updated – 19/10/2025