ComfyUI > Nodes > Bmad Nodes > Filter Contour

ComfyUI Node: Filter Contour

Class Name

Filter Contour

Category
Bmad/CV/Contour
Author
bmad4ever (Account age: 3591days)
Extension
Bmad Nodes
Latest Updated
2024-08-02
Github Stars
0.05K

How to Install Bmad Nodes

Install this extension via the ComfyUI Manager by searching for Bmad Nodes
  • 1. Click the Manager button in the main menu
  • 2. Select Custom Nodes Manager button
  • 3. Enter Bmad Nodes in the search bar
After installation, click the Restart button to restart ComfyUI. Then, manually refresh your browser to clear the cache and access the updated list of nodes.

Visit ComfyUI Online for ready-to-use ComfyUI environment

  • Free trial available
  • High-speed GPU machines
  • 200+ preloaded models/nodes
  • Freedom to upload custom models/nodes
  • 50+ ready-to-run workflows
  • 100% private workspace with up to 200GB storage
  • Dedicated Support

Run ComfyUI Online

Filter Contour Description

Refine contours based on fitness function for precise shape selection in image processing.

Filter Contour:

The Filter Contour node is designed to refine and select specific contours from a list based on a custom fitness function. This node is particularly useful for AI artists who need to isolate and work with specific shapes or boundaries within an image. By applying a fitness function, you can evaluate each contour and select the ones that meet your criteria, allowing for more precise and targeted image processing. This node can be used in various applications, such as object detection, shape analysis, and image segmentation, providing a powerful tool for enhancing your creative projects.

Filter Contour Input Parameters:

contours

This parameter represents the list of contours that you want to filter. Each contour is a set of points that define the boundary of a shape within the image. The quality and characteristics of the contours will directly impact the filtering process.

fitness

The fitness parameter is a custom function that evaluates each contour based on specific criteria. This function determines how well a contour meets your requirements. The fitness function can use various properties of the contour, such as area, perimeter, or aspect ratio, to calculate a fitness score. The higher the score, the more likely the contour will be selected.

select

This parameter specifies the selection method to be used after evaluating the contours with the fitness function. It determines how the contours are chosen based on their fitness scores. Common selection methods include choosing the top N contours, selecting contours above a certain fitness threshold, or picking the single best contour.

image (optional)

The image parameter is an optional input that provides the original image from which the contours were derived. This can be useful if the fitness function needs to reference the image for additional context or calculations.

aux_contour (optional)

The aux_contour parameter is an optional input that provides an auxiliary contour for comparison or additional calculations within the fitness function. This can be useful for more complex filtering criteria that involve relationships between multiple contours.

Filter Contour Output Parameters:

filtered_contour

This output parameter represents the contour that best meets the criteria defined by the fitness function and selection method. It is the primary result of the filtering process and can be used for further image processing or analysis.

all_filtered_contours

This output parameter provides a list of all contours that were evaluated and selected based on the fitness function and selection method. It includes the primary filtered contour as well as any additional contours that met the criteria.

Filter Contour Usage Tips:

  • Ensure that your fitness function is well-defined and tailored to the specific characteristics you are looking for in the contours. This will improve the accuracy and relevance of the filtered results.
  • Use the optional image and aux_contour parameters to provide additional context and improve the robustness of your fitness function.
  • Experiment with different selection methods to find the one that best suits your needs. For example, if you need multiple contours, use a method that selects the top N contours rather than just the single best one.

Filter Contour Common Errors and Solutions:

Contour list is empty

  • Explanation: This error occurs when the input list of contours is empty, meaning there are no contours to filter.
  • Solution: Ensure that the input image has been processed correctly to generate contours before passing it to the Filter Contour node. Check the preceding steps in your workflow to confirm that contours are being detected and passed correctly.

Index out of range

  • Explanation: This error occurs when the index specified for selecting a contour is outside the range of available contours.
  • Solution: Verify that the index parameter is within the valid range of the contour list. Adjust the index value to ensure it falls within the bounds of the available contours.

Invalid fitness function

  • Explanation: This error occurs when the fitness function provided is not valid or contains errors.
  • Solution: Double-check the syntax and logic of your fitness function. Ensure that it correctly references the necessary properties and functions for evaluating the contours. Test the fitness function independently to confirm its validity before using it in the Filter Contour node.

Filter Contour Related Nodes

Go back to the extension to check out more related nodes.
Bmad Nodes
RunComfy

© Copyright 2024 RunComfy. All Rights Reserved.

RunComfy is the premier ComfyUI platform, offering ComfyUI online environment and services, along with ComfyUI workflows featuring stunning visuals.