Binary
AI-generatedOverview
This node integrates OpenCV.js functionality into n8n workflows, enabling advanced image processing operations on binary image data. It supports multiple OpenCV modules such as thresholding, color modifications, edge detection, blurring, morphological transformations, contour analysis, and binary bitwise operations.
Typical use cases include:
- Preprocessing images for computer vision tasks (e.g., noise reduction with blurring).
- Extracting edges or contours for shape analysis.
- Applying thresholding to segment images.
- Performing morphological operations like erosion or dilation to refine image masks.
- Combining or manipulating binary images using bitwise operations.
For example, you could input a binary image from a previous node, apply a Gaussian blur to reduce noise, then detect edges using the Canny method, and finally extract contours for object recognition.
Properties
| Name | Meaning |
|---|---|
| Input Image Field Name | The name of the binary property in the input data that contains the image to be processed. Must be an image binary property. |
| Module | The OpenCV module to use. Options: Binary Operations, Blurring, Color Modifications, Contours, Edge Detection, Image Stats, Morphological, Thresholding. |
| Mode (for Binary operation) | Thresholding mode when using the "binary" operation. Options: Normal, Inverted, Truncate, To Zero, To Zero (Inverted). |
| Threshold | Numeric value used as the threshold level in thresholding operations. |
| Kernel Size | Size of the kernel (square) used in morphological operations. Should be an odd number. |
| Mode (for Blur module) | Type of blurring algorithm. Options: Box Blur (Averaging), Gaussian Blur, Median Blur, Bilateral Filter. |
| Window Size (ksize) | Size of the kernel/window for blurring operations. |
| Color Sigma | Parameter for bilateral filter controlling color space sigma (range sigma). |
| Spatial Sigma | Parameter for bilateral filter controlling coordinate space sigma. |
| Method (for Edge Detection) | Edge detection method. Options: Canny, Laplacian, Sobel. |
| Aperture Size (ksize) | Aperture size used to compute derivatives in edge detection. |
| Lower Threshold | Lower threshold for Canny edge detection. |
| Upper Threshold | Upper threshold for Canny edge detection. |
| Advanced Options | Collection of additional optional parameters including: |
| - Output Image Field Name | Name of the binary property where the output image will be stored. Default is "out". |
| - Histogram Height | Height parameter for histogram computations (used in stats module). |
| - Scale | Scale factor for gradient values in edge detection (Laplacian, Sobel). |
| - Delta | Delta value added to results in edge detection (Laplacian, Sobel). |
| - Color | Color used to draw contours (in contour drawing operations). |
| - Line Width | Line width for drawing contours. |
Output
The node outputs the processed image data in the specified binary property (default "out"). This binary data represents the result of the selected OpenCV operation applied to the input image.
The output JSON structure typically includes the original input fields plus the new or modified binary image field containing the processed image.
If applicable, the node may also output statistical data or contour information depending on the chosen module.
Dependencies
- Requires OpenCV.js runtime loaded and initialized.
- No external API keys or services are needed; all processing is done locally within the node using OpenCV.js.
- The node expects input data to contain binary image properties compatible with OpenCV.js processing.
Troubleshooting
- Input Image Missing or Invalid: Ensure the input binary property specified by "Input Image Field Name" exists and contains valid image data. Errors may occur if the property is missing or not an image.
- Kernel Size Must Be Odd: For morphological operations, kernel size should be an odd number. Using even numbers might cause unexpected behavior.
- Threshold Values Out of Range: Threshold parameters should be within valid pixel value ranges (usually 0-255). Invalid values can lead to incorrect processing.
- Unsupported Operation or Module: Selecting a module or operation not supported by the node will result in no action or errors.
- Output Property Conflicts: If the output image field name conflicts with existing properties, it may overwrite data unintentionally. Choose unique names if necessary.