Skip to main content

Enhance Borders

Enhances the borders and edges in an image using morphological operations to highlight horizontal and vertical lines.

Common Properties

  • Name - The custom name of the node.
  • Color - The custom color of the node.
  • Delay Before (sec) - Waits in seconds before executing the node.
  • Delay After (sec) - Waits in seconds after executing node.
  • Continue On Error - Automation will continue regardless of any error. The default value is false.
info

If the ContinueOnError property is true, no error is caught when the project is executed, even if a Catch node is used.

Inputs

  • In Path - Path to the input image file.
  • Out Path - Path where the enhanced borders output image will be saved.

Options

  • Block Size - Size of pixel neighborhood for adaptive thresholding. Must be an odd number between 3-99. Default is 15.
  • Horizontal Line Length - Minimum length to detect horizontal lines. Value between 20-100. Default is 40.
  • Vertical Line Length - Minimum length to detect vertical lines. Value between 20-100. Default is 40.
  • Line Thickness - How much to thicken detected lines. Value between 1-10. Default is 3.
  • Preserve Original - If true, enhanced borders are overlaid on the original image. If false, only shows enhanced borders. Default is true.

Output

  • result - Boolean indicating success or failure of the border enhancement operation.

How It Works

The Enhance Borders node uses ImageMagick library to detect and enhance horizontal and vertical lines in an image through morphological operations. When executed, the node:

  1. Validates input and output file paths
  2. Loads the specified input image and converts it to grayscale
  3. Applies adaptive thresholding to create a binary version of the image
  4. Uses morphological operations to detect horizontal and vertical lines separately
  5. Combines the detected lines and thickens them based on the Line Thickness parameter
  6. Either overlays the enhanced borders on the original image or outputs only the enhanced borders based on the Preserve Original option
  7. Saves the resulting image to the output path

Requirements

  • Valid input image file at the specified path
  • Output path must be writable
  • Valid numeric values for all parameters within their specified ranges

Error Handling

The node will return specific errors in the following cases:

  • Empty or invalid input file path
  • Input file not found at the specified path
  • Empty or invalid output file path
  • Block Size is not an odd number or less than 3
  • Horizontal Line Length is not positive
  • Vertical Line Length is not positive
  • Line Thickness is not between 1 and 10

Usage Notes

  • Works best on images with clear horizontal and vertical lines such as documents, tables, or architectural drawings
  • Higher Block Size values will detect larger regions but may miss fine details
  • Horizontal and Vertical Line Length parameters control sensitivity to lines of different lengths
  • Line Thickness parameter controls how prominent the enhanced borders appear
  • When Preserve Original is enabled, the enhanced borders are overlaid on the original image for context
  • When Preserve Original is disabled, only the enhanced borders are visible in the output
  • Processing time increases with larger images and higher parameter values
  • Results may vary depending on image quality and content