Visit ComfyUI Online for ready-to-use ComfyUI environment
Convert contours to mask images for AI artists to isolate and manipulate specific image regions efficiently.
The Contour To Mask node is designed to convert a contour, which is a curve joining all the continuous points along a boundary having the same color or intensity, into a mask image. This node is particularly useful for AI artists who need to isolate specific regions of an image based on contours detected in previous steps. By transforming contours into masks, you can easily manipulate or analyze specific parts of an image, enhancing your creative workflow. The node leverages OpenCV functions to draw the contour onto a blank image, effectively creating a binary mask where the contour area is filled. This mask can then be used for various image processing tasks, such as masking, segmentation, or further image analysis.
This parameter expects an image input in the form of a tensor. The image serves as the canvas onto which the contour will be drawn. Although the image content itself is not used, its dimensions are essential to create a blank image of the same size for the mask. The image should be pre-processed and converted to a tensor format compatible with the node.
The contour parameter requires a contour input, which is a list of points defining the boundary of a shape within the image. This contour is used to draw the mask. The contour should be detected and provided by a preceding node or process that identifies contours in an image. The contour data must be in a format compatible with OpenCV's drawContours
function.
This parameter specifies the desired output format for the resulting mask image. It offers several options, such as different image formats (e.g., PNG, JPEG) or tensor formats, with a default value set to the first option in the list. The output format determines how the mask image will be encoded and stored, which can be crucial for subsequent processing steps.
The output of this node is an image tensor representing the mask. In this mask, the area inside the contour is filled with white (255), and the rest of the image is black (0). This binary mask can be used for various image processing tasks, such as masking out regions, segmentation, or as an input for further analysis or manipulation in your AI art projects.
© Copyright 2024 RunComfy. All Rights Reserved.