Check Mask (UTK):
The CheckMask_UTK node is designed to evaluate image masks by determining if a specified percentage of the mask area is white. This node is particularly useful in image processing tasks where masks are used to isolate or highlight specific regions of an image. By checking the proportion of the mask that is white, you can make informed decisions about whether the mask meets certain criteria for further processing or analysis. This functionality is essential for workflows that require precise control over masked areas, such as inpainting, segmentation, or compositing tasks. The node ensures that masks are appropriately sized and converted for evaluation, providing a reliable method to assess mask coverage.
Check Mask (UTK) Input Parameters:
mask
The mask parameter is the input image mask that you want to evaluate. It is crucial for this parameter to be a valid mask tensor, as the node will process this input to determine the white area percentage. If the mask is not provided or is invalid, the node will not be able to perform its function. The mask should ideally be a two-dimensional tensor, but if it is not, the node will attempt to adjust it accordingly. There are no specific minimum or maximum values for this parameter, but it must be a valid tensor representing an image mask.
white_point
The white_point parameter defines the threshold for what is considered "white" in the mask. This parameter is used to calculate the percentage of the mask area that is white. Adjusting this value can impact the node's sensitivity to different shades of white, allowing for more precise control over what is considered a white area in the mask. The exact range or default value for this parameter is not specified, but it should be set according to the desired sensitivity for white detection.
area_percent
The area_percent parameter specifies the minimum percentage of the mask area that must be white for the node to return a positive result. This parameter is crucial for determining whether the mask meets the required criteria for further processing. By setting this value, you can control the strictness of the mask evaluation, ensuring that only masks with sufficient white coverage are accepted. The parameter should be set as a percentage, with typical values ranging from 0 to 100.
Check Mask (UTK) Output Parameters:
ret
The ret output parameter is a boolean value that indicates whether the mask meets the specified white area percentage criteria. If the percentage of the white area in the mask exceeds the area_percent threshold, the node returns True; otherwise, it returns False. This output is essential for decision-making processes in workflows that rely on mask evaluation, allowing you to filter or select masks based on their coverage.
Check Mask (UTK) Usage Tips:
- Ensure that the input mask is a valid tensor and properly formatted to avoid processing errors.
- Adjust the
white_pointparameter to fine-tune the sensitivity of white detection in the mask, especially if working with masks that have varying shades of white. - Set the
area_percentparameter according to the specific requirements of your task to ensure that only masks with adequate white coverage are accepted.
Check Mask (UTK) Common Errors and Solutions:
Check Mask (UTK): mask is None
- Explanation: This error occurs when the input mask is not provided or is
None. - Solution: Ensure that a valid mask tensor is passed to the node as input.
Check Mask (UTK): Failed to convert mask to PIL
- Explanation: This error indicates that the mask could not be converted to a PIL image, possibly due to an invalid format.
- Solution: Verify that the input mask is a valid tensor and correctly formatted for conversion to a PIL image.
Check Mask (UTK): Mask size exceeds limit
- Explanation: The mask size exceeds the maximum allowed dimensions for processing.
- Solution: Resize the mask to a smaller dimension before inputting it into the node, ensuring it does not exceed the size limit.
