Save 4 hours! We auto-setup your workflow! Free!

Drop your workflow.json — we handle every dependency, custom node, and model. Just open the link and run.

Auto-Setup Workflow Json (Free) Now!
ComfyUI > Nodes > opencv-comfyui > OpenCV Scharr_1

ComfyUI Node: OpenCV Scharr_1

Class Name

Scharr_1

Category
image/OpenCV
Author
geroldmeisinger (Account age: 1432days)
Extension
opencv-comfyui
Latest Updated
2026-07-22
Github Stars
0.04K

How to Install opencv-comfyui

Install this extension via the ComfyUI Manager by searching for opencv-comfyui
  • 1. Click the Manager button in the main menu
  • 2. Select Custom Nodes Manager button
  • 3. Enter opencv-comfyui 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
  • 16GB VRAM to 80GB VRAM GPU machines
  • 400+ preloaded models/nodes
  • Freedom to upload custom models/nodes
  • 200+ ready-to-run workflows
  • 100% private workspace with up to 200GB storage
  • Dedicated Support

Run ComfyUI Online

OpenCV Scharr_1 Description

Performs edge detection on images using the Scharr operator for enhanced feature visibility.

OpenCV Scharr_1:

The Scharr_1 node is designed to perform edge detection on images using the Scharr operator, a specialized derivative filter in the OpenCV library. This node is particularly useful for highlighting edges and transitions in an image, which can be crucial for various image processing tasks such as feature detection, image segmentation, and computer vision applications. The Scharr operator is known for its ability to provide a more accurate approximation of the derivative than the traditional Sobel operator, especially when dealing with small gradients. By applying this operator, you can enhance the visibility of edges in your images, making it easier to identify and analyze key features. This node is an essential tool for AI artists and developers who need to preprocess images for further analysis or artistic transformation.

OpenCV Scharr_1 Input Parameters:

src

The src parameter represents the source image on which the Scharr operator will be applied. It is expected to be a numpy array (NPARRAY) that contains the pixel data of the image. This parameter is crucial as it serves as the input for the edge detection process.

ddepth

The ddepth parameter specifies the depth of the output image. It is an integer value that determines the data type of the output image. A common choice is -1, which indicates that the output image will have the same depth as the source image. This parameter affects the precision and range of the output image.

dx

The dx parameter is an integer that indicates the order of the derivative in the x-direction. It determines how the Scharr operator will compute the gradient along the horizontal axis. Typically, this value is set to 1 to calculate the first derivative.

dy

The dy parameter is an integer that specifies the order of the derivative in the y-direction. Similar to dx, it determines the gradient computation along the vertical axis. A common setting is 1 to obtain the first derivative.

scale

The scale parameter is a floating-point value that scales the computed derivative values. It allows you to adjust the magnitude of the gradients, which can be useful for emphasizing or de-emphasizing certain features in the image. The default value is usually 1.0.

delta

The delta parameter is a floating-point value added to the results of the convolution. It can be used to adjust the brightness of the output image, ensuring that the gradient values are within a desired range. The default value is typically 0.0.

borderType

The borderType parameter is an integer that defines how the image borders are handled during the convolution process. It specifies the method used to extrapolate pixel values beyond the image boundaries. Common options include cv2.BORDER_DEFAULT, which uses a default border handling method.

dst

The dst parameter is an optional numpy array (NPARRAY) that can be used to store the output image. If provided, the results of the Scharr operation will be written to this array. If not specified, a new array will be created to hold the output.

OpenCV Scharr_1 Output Parameters:

nparray

The nparray output parameter is a numpy array that contains the result of the Scharr operation. This array represents the processed image with enhanced edges, highlighting the transitions and features detected by the Scharr operator. The output can be used for further image analysis or as a preprocessed input for other image processing tasks.

OpenCV Scharr_1 Usage Tips:

  • To achieve optimal edge detection, ensure that the dx and dy parameters are set to 1, as this configuration is designed to compute the first derivative, which is most effective for highlighting edges.
  • Experiment with the scale and delta parameters to adjust the contrast and brightness of the output image, which can help in emphasizing specific features or achieving a desired visual effect.

OpenCV Scharr_1 Common Errors and Solutions:

Invalid depth of output image

  • Explanation: This error occurs when the ddepth parameter is set to an unsupported value, leading to an invalid output image depth.
  • Solution: Ensure that the ddepth parameter is set to -1 or a valid integer that matches the desired output image depth.

Unsupported border type

  • Explanation: This error arises when the borderType parameter is set to an unsupported value, causing issues with border handling during convolution.
  • Solution: Verify that the borderType parameter is set to a valid OpenCV border type, such as cv2.BORDER_DEFAULT, to ensure proper border handling.

OpenCV Scharr_1 Related Nodes

Go back to the extension to check out more related nodes.
opencv-comfyui
RunComfy
Copyright 2025 RunComfy. All Rights Reserved.

RunComfy is the premier ComfyUI platform, offering ComfyUI online environment and services, along with ComfyUI workflows featuring stunning visuals. RunComfy also provides AI Models, enabling artists to harness the latest AI tools to create incredible art.