Automatic
AI-generatedOverview
This node integrates OpenCV.js functionality into n8n workflows, enabling advanced image processing directly within automation pipelines. It supports a variety of computer vision operations such as thresholding, color modifications, contour detection and drawing, edge detection, morphological transformations, blurring, binary bitwise operations, and image statistics.
Typical use cases include:
- Automatically segmenting images using thresholding methods like Otsu or Triangle.
- Enhancing images by applying blurs or color adjustments.
- Detecting edges or contours for object recognition or analysis.
- Performing morphological operations to clean up or modify shapes in images.
- Computing image statistics or histograms for further data-driven decisions.
For example, you could automatically detect edges in an uploaded photo to highlight objects, or apply a Gaussian blur to reduce noise before further processing.
Properties
| Name | Meaning |
|---|---|
| Input Image Field Name | The name of the binary property containing the input image to be processed. This must hold image data. |
| Module | The OpenCV module to use. Options: Binary Operations (bitwise AND, OR, NOT), Blurring (various blur algorithms), Color Modifications, Contours, Edge Detection, Image Stats, Morphological operations, Thresholding. |
| Method (for Automatic) | The automatic thresholding method to use. Options: Otsu (optimal threshold via Otsu's method), Triangle (optimal threshold via triangle method). |
| Kernel Size | Size of the kernel (square) used in morphological operations. Use odd numbers only. |
| Mode (for Blur module) | The blurring algorithm to apply. Options: Box Blur (averaging), Gaussian Blur, Median Blur (good for impulse noise removal), Bilateral Filter (preserves edges but slower). |
| Window Size | Size of the kernel/window for averaging in blur operations. |
| Color Sigma | For bilateral filter: sigma value in color space controlling how colors are mixed. Larger values mix farther colors. |
| Spatial Sigma | For bilateral filter: sigma value in coordinate space controlling pixel influence range. |
| Method (for Edge Detection) | Edge detection algorithm to use. Options: Canny, Laplacian, Sobel. |
| Aperture Size | Aperture size for computing 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 settings including: - Output Image Field Name: name of the binary property to store the output image. - Histogram Height (for stats module). - Scale and Delta (for edge detection). - Color and Line Width (for contour drawing). |
Output
The node outputs processed images in the specified binary property (default "out") containing the result of the selected OpenCV operation. The output is typically an image buffer representing the transformed image after applying thresholding, blurring, edge detection, etc.
If image statistics or histograms are computed, the output JSON may contain numerical data arrays representing these metrics.
Binary data always represents image content suitable for further workflow steps that accept image inputs.
Dependencies
- Requires OpenCV.js runtime initialized in the environment.
- No external API keys or services are needed; all processing is done locally via OpenCV.js.
- Ensure the input binary property contains valid image data compatible with OpenCV.js.
Troubleshooting
- Invalid Input Image: If the specified input image field does not contain valid image data, the node will fail. Verify the binary property name and ensure it holds an image.
- Unsupported Kernel Sizes: Kernel sizes for morphological and blur operations should be positive odd numbers. Using even or zero values may cause errors.
- Incorrect Parameter Combinations: Some parameters are only valid for specific modules or methods (e.g., thresholds only for Canny edge detection). Setting incompatible options may lead to unexpected results or errors.
- Performance Issues: Bilateral filtering is computationally intensive and may slow down execution on large images.
- Output Property Conflicts: Make sure the output image field name does not overwrite important data unless intended.