Save 4 hours! We auto-setup your workflow! Free!

Drop your workflow.json — we handle every dependency, custom node, and model. Just open the link and run.

Auto-Setup Workflow Json (Free) Now!
ComfyUI > Nodes > opencv-comfyui > OpenCV Mahalanobis_1

ComfyUI Node: OpenCV Mahalanobis_1

Class Name

Mahalanobis_1

Category
image/OpenCV
Author
geroldmeisinger (Account age: 1432days)
Extension
opencv-comfyui
Latest Updated
2026-07-22
Github Stars
0.04K

How to Install opencv-comfyui

Install this extension via the ComfyUI Manager by searching for opencv-comfyui
  • 1. Click the Manager button in the main menu
  • 2. Select Custom Nodes Manager button
  • 3. Enter opencv-comfyui in the search bar
After installation, click the Restart button to restart ComfyUI. Then, manually refresh your browser to clear the cache and access the updated list of nodes.

Visit ComfyUI Online for ready-to-use ComfyUI environment

  • Free trial available
  • 16GB VRAM to 80GB VRAM GPU machines
  • 400+ preloaded models/nodes
  • Freedom to upload custom models/nodes
  • 200+ ready-to-run workflows
  • 100% private workspace with up to 200GB storage
  • Dedicated Support

Run ComfyUI Online

OpenCV Mahalanobis_1 Description

Calculates Mahalanobis distance using OpenCV for multivariate anomaly detection and clustering.

OpenCV Mahalanobis_1:

The Mahalanobis_1 node is designed to calculate the Mahalanobis distance between two points, which is a measure used in statistics to determine the distance between a point and a distribution. This node leverages the OpenCV library's Mahalanobis function to perform this calculation. The Mahalanobis distance is particularly useful in multivariate anomaly detection, classification, and clustering tasks because it accounts for correlations between variables and the variability of the data. By using this node, you can effectively measure how far a point is from the mean of a distribution, considering the spread and correlation of the data, which is crucial for tasks that require understanding the relationship between different data dimensions.

OpenCV Mahalanobis_1 Input Parameters:

v1

v1 is a required input parameter representing the first point in the form of a NumPy array. This parameter is crucial as it defines one of the two points between which the Mahalanobis distance will be calculated. The values in this array should correspond to the dimensions of the data you are analyzing. There are no specific minimum or maximum values, but the array should match the dimensionality of v2 and icovar.

v2

v2 is another required input parameter that represents the second point, also in the form of a NumPy array. Similar to v1, this parameter is essential for calculating the distance, as it defines the second point in the space. The array should have the same dimensions as v1 and should be consistent with the data's dimensionality.

icovar

icovar is a required input parameter that stands for the inverse covariance matrix of the data, provided as a NumPy array. This matrix is critical because it adjusts the distance calculation to account for the variance and correlation of the data dimensions. The inverse covariance matrix should be square and its size should match the number of dimensions in v1 and v2.

OpenCV Mahalanobis_1 Output Parameters:

float

The output parameter float represents the calculated Mahalanobis distance as a floating-point number. This value quantifies the distance between the two points v1 and v2 in the context of the distribution defined by the inverse covariance matrix icovar. A smaller distance indicates that the points are closer in the distribution space, while a larger distance suggests they are further apart. This output is crucial for applications that require precise distance measurements in multivariate spaces.

OpenCV Mahalanobis_1 Usage Tips:

  • Ensure that the dimensions of v1, v2, and icovar are consistent. The points v1 and v2 should have the same number of dimensions, and icovar should be a square matrix with dimensions matching those of the points.
  • Use this node in applications where understanding the relationship between different data dimensions is important, such as anomaly detection or clustering.

OpenCV Mahalanobis_1 Common Errors and Solutions:

Dimension Mismatch Error

  • Explanation: This error occurs when the dimensions of v1, v2, and icovar do not match. The points and the inverse covariance matrix must have compatible dimensions for the calculation to proceed.
  • Solution: Verify that v1 and v2 have the same number of dimensions and that icovar is a square matrix with dimensions matching those of the points.

Singular Matrix Error

  • Explanation: This error arises when the inverse covariance matrix icovar is singular, meaning it cannot be inverted. This situation can occur if the covariance matrix is not full rank.
  • Solution: Ensure that the covariance matrix used to derive icovar is full rank and invertible. You may need to regularize the covariance matrix or check the data for collinearity issues.

OpenCV Mahalanobis_1 Related Nodes

Go back to the extension to check out more related nodes.
opencv-comfyui
RunComfy
Copyright 2025 RunComfy. All Rights Reserved.

RunComfy is the premier ComfyUI platform, offering ComfyUI online environment and services, along with ComfyUI workflows featuring stunning visuals. RunComfy also provides AI Models, enabling artists to harness the latest AI tools to create incredible art.

OpenCV Mahalanobis_1