Nodes/Image Misc/Estimate foreground (FMLFE)
ComfyUI Node

Estimate foreground (FMLFE)

Estimate the foreground image using Fast Multi-Level Foreground Estimation.

By set-soft·Created about a year ago·Updated 7 months ago· 2
Estimate foreground (FMLFE)
  • images
  • masks
  • foreground
  • background
  • mask
implementationauto
regularization0.0000
n_small_iterations10
n_big_iterations2
small_size32
gradient_weight1.0
Categoryimage/foreground

Inputs (8)

NameTypeDefaultDescription
imagesIMAGEThe source image(s) from which to estimate the foreground and background.
masksMASKThe alpha matte that guides the estimation. White areas are treated as known foreground, black as known background, and gray areas are the semi-transparent regions the algorithm will solve for.
implementationCOMBOauto5 options: auto, cupy, opencl, numba, torch
regularizationoptFLOAT0.00000–0.1The regularization strength (epsilon). This acts as a smoothness prior. Higher values result in smoother, more blended foreground and background colors, but may lose very fine details. Lower values preserve more detail but can be noisier.
n_small_iterationsoptINT101–100The number of solver iterations to perform on the lower-resolution levels of the image pyramid. More iterations can improve quality at the cost of speed.
n_big_iterationsoptINT21–100The number of solver iterations to perform on the higher-resolution (larger) levels of the image pyramid. Fewer iterations are typically needed at high resolution as the details are propagated up from the smaller levels.
small_sizeoptINT328–256The pixel dimension threshold. Image pyramid levels smaller than this size will use the higher 'n_small_iterations' count, while larger levels will use 'n_big_iterations'.
gradient_weightoptFLOAT1.00–10Controls how strongly the edges in the alpha matte influence color blending. A higher value makes the algorithm respect the mask's edges more, leading to sharper color boundaries. A lower value allows more color bleeding, an effect similar to increasing regularization.

Outputs (3)

NameTypeDescription
foregroundIMAGE
backgroundIMAGE
maskMASK