# Documentation - Class name: Inference_Core_LeReS-DepthMapPreprocessor - Category: ControlNet Preprocessors/Normal and Depth Estimators - Output node: False Inference_Core_LeReS-DepthMapPreprocessor节点专门用于利用LeReS算法对图像进行预处理以生成深度图。它通过可选的深度估计增强过程和特定的调整来增强图像深度感知,例如移除最近的物体或背景,旨在提高深度质量,以便进行进一步处理或可视化。 # Input types ## Required - image - 需要进行深度图生成处理的输入图像。 - Comfy dtype: IMAGE - Python dtype: numpy.ndarray ## Optional - rm_nearest - 指定用于在深度图中移除最近物体的阈值,以增强对较远元素的关注。 - Comfy dtype: FLOAT - Python dtype: float - rm_background - 定义深度图中背景移除的阈值,有助于将主要主体与周围环境隔离。 - Comfy dtype: FLOAT - Python dtype: float - boost - 启用或禁用深度估计的增强模式,其中"enable"选项可显著增强深度图的细节。 - Comfy dtype: COMBO[STRING] - Python dtype: str - resolution - 生成深度图的分辨率,影响输出的细节水平。 - Comfy dtype: INT - Python dtype: int # Output types - image - 处理后的深度图图像,针对进一步的计算任务或可视化进行了优化。 - Comfy dtype: IMAGE - Python dtype: numpy.ndarray ## Usage tips - Infra type: `GPU` - Common nodes: unknown ## Source code ```python class LERES_Depth_Map_Preprocessor: @classmethod def INPUT_TYPES(s): return create_node_input_types( rm_nearest=("FLOAT", {"default": 0.0, "min": 0.0, "max": 100, "step": 0.1}), rm_background=("FLOAT", {"default": 0.0, "min": 0.0, "max": 100, "step": 0.1}), boost=(["enable", "disable"], {"default": "disable"}) ) RETURN_TYPES = ("IMAGE",) FUNCTION = "execute" CATEGORY = "ControlNet Preprocessors/Normal and Depth Estimators" def execute(self, image, rm_nearest, rm_background, resolution=512, **kwargs): from controlnet_aux.leres import LeresDetector model = LeresDetector.from_pretrained().to(model_management.get_torch_device()) out = common_annotator_call(model, image, resolution=resolution, thr_a=rm_nearest, thr_b=rm_background, boost=kwargs["boost"] == "enable") del model return (out, ) ```