Border Mask & Crop Detector:
The BorderMaskDetector is a specialized node designed to identify and mask the borders of an image based on color consistency. Its primary function is to detect uniform areas along the edges of an image, which can be particularly useful in scenarios where you need to isolate or highlight the central content by masking out the borders. This node operates by scanning the image's edges and comparing pixel colors to a median value, allowing it to determine where the border ends and the main content begins. By doing so, it helps in creating clean and precise masks that can be used for further image processing tasks, such as cropping or compositing. The BorderMaskDetector is beneficial for artists and designers who need to automate the process of border detection, ensuring that the focus remains on the main subject of the image without manual intervention.
Border Mask & Crop Detector Input Parameters:
image
The image parameter is the input image on which the border detection and masking will be performed. It serves as the primary data source for the node's operations. The image should be in a format compatible with the node's processing capabilities, typically a tensor representation of an RGB image.
detect_top
The detect_top parameter is a boolean flag that determines whether the top border of the image should be scanned and detected. If set to True, the node will analyze the top edge of the image to identify uniform color areas that constitute the border.
detect_bottom
The detect_bottom parameter is a boolean flag that controls the detection of the bottom border of the image. When enabled, the node will scan the bottom edge to find consistent color regions that define the border.
detect_left
The detect_left parameter is a boolean flag indicating whether the left border of the image should be detected. If True, the node will examine the left edge for uniform color areas that form the border.
detect_right
The detect_right parameter is a boolean flag that specifies whether the right border of the image should be detected. Enabling this option prompts the node to scan the right edge for consistent color regions that make up the border.
threshold
The threshold parameter is a float value that sets the minimum proportion of pixels that must match the median color to consider an area as part of the border. It ranges from 0.0 to 1.0, with a default value that typically balances sensitivity and specificity in border detection.
color_tolerance
The color_tolerance parameter defines the allowable deviation in color values when comparing pixels to the median color. It determines how strictly the node matches colors, with lower values requiring more precise matches and higher values allowing for greater variation.
max_scan_depth
The max_scan_depth parameter is a float that specifies the maximum depth, as a proportion of the image's dimension, to which the node will scan for borders. It controls how far into the image the node will look for consistent color areas, with values typically ranging from 0.0 to 1.0.
Border Mask & Crop Detector Output Parameters:
masks
The masks output parameter is a tensor that represents the detected border areas of the image. Each element in the tensor corresponds to a pixel in the input image, with values indicating whether the pixel is part of the detected border (1.0) or not (0.0). This output can be used for further image processing tasks, such as masking or compositing.
Border Mask & Crop Detector Usage Tips:
- To achieve optimal results, adjust the
thresholdandcolor_toleranceparameters based on the image's color complexity. For images with subtle color variations, a lowercolor_tolerancemay be necessary. - Use the
max_scan_depthparameter to control how aggressively the node searches for borders. For images with wide borders, a higher scan depth may be beneficial. - Enable only the necessary border detection flags (
detect_top,detect_bottom,detect_left,detect_right) to improve performance and focus on specific areas of interest.
Border Mask & Crop Detector Common Errors and Solutions:
Image format not supported
- Explanation: The input image is not in a compatible format for processing.
- Solution: Ensure the image is in a tensor format, typically representing an RGB image, before passing it to the node.
Threshold value out of range
- Explanation: The
thresholdparameter is set outside the allowable range of 0.0 to 1.0. - Solution: Adjust the
thresholdvalue to be within the specified range to ensure proper operation.
Color tolerance too high
- Explanation: The
color_toleranceparameter is set too high, causing incorrect border detection. - Solution: Reduce the
color_tolerancevalue to improve the accuracy of color matching during border detection.
