EdgeDetector

Edge detector uses Sobel filter to create an image that emphasises edges.

How to place it

pipeline = dai.Pipeline()
edgeDetector = pipeline.create(dai.node.EdgeDetector)
dai::Pipeline pipeline;
auto edgeDetector = pipeline.create<dai::node::EdgeDetector>();

Inputs and Outputs

               ┌───────────────────┐
inputImage     │                   │
──────────────►│                   │
               │                   │ outputImage
               │   EdgeDetector    ├───────────►
inputConfig    │                   │
──────────────►│                   │
               │                   │
               └───────────────────┘

Message types

Usage

pipeline = dai.Pipeline()
edgeDetector = pipeline.create(dai.node.EdgeDetector)

sobelHorizontalKernel = [[1, 0, -1], [2, 0, -2], [1, 0, -1]]
sobelVerticalKernel = [[1, 2, 1], [0, 0, 0], [-1, -2, -1]]
edgeDetector.initialConfig.setSobelFilterKernels(sobelHorizontalKernel, sobelVerticalKernel)
dai::Pipeline pipeline;
auto edgeDetector = pipeline.create<dai::node::EdgeDetector>();

std::vector<std::vector<int>> sobelHorizontalKernel = {{1, 0, -1}, {2, 0, -2}, {1, 0, -1}};
std::vector<std::vector<int>> sobelVerticalKernel = {{1, 2, 1}, {0, 0, 0}, {-1, -2, -1}};
edgeDetector->setSobelFilterKernels(sobelHorizontalKernel, sobelVerticalKernel);

Examples of functionality

Reference

class depthai.node.EdgeDetector

EdgeDetector node. Performs edge detection using 3x3 Sobel filter

class Connection

Connection between an Input and Output

class Id

Node identificator. Unique for every node on a single Pipeline

Properties

alias of depthai.EdgeDetectorProperties

getAssetManager(*args, **kwargs)

Overloaded function.

  1. getAssetManager(self: depthai.Node) -> depthai.AssetManager

Get node AssetManager as a const reference

  1. getAssetManager(self: depthai.Node) -> depthai.AssetManager

Get node AssetManager as a const reference

getInputRefs(*args, **kwargs)

Overloaded function.

  1. getInputRefs(self: depthai.Node) -> List[depthai.Node.Input]

Retrieves reference to node inputs

  1. getInputRefs(self: depthai.Node) -> List[depthai.Node.Input]

Retrieves reference to node inputs

getInputs(self: depthai.Node) → List[depthai.Node.Input]

Retrieves all nodes inputs

getName(self: depthai.Node)str

Retrieves nodes name

getOutputRefs(*args, **kwargs)

Overloaded function.

  1. getOutputRefs(self: depthai.Node) -> List[depthai.Node.Output]

Retrieves reference to node outputs

  1. getOutputRefs(self: depthai.Node) -> List[depthai.Node.Output]

Retrieves reference to node outputs

getOutputs(self: depthai.Node) → List[depthai.Node.Output]

Retrieves all nodes outputs

getParentPipeline(*args, **kwargs)

Overloaded function.

  1. getParentPipeline(self: depthai.Node) -> depthai.Pipeline

  2. getParentPipeline(self: depthai.Node) -> depthai.Pipeline

property id

Id of node

property initialConfig

Initial config to use for edge detection.

property inputConfig

Input EdgeDetectorConfig message with ability to modify parameters in runtime. Default queue is non-blocking with size 4.

property inputImage

Input image on which edge detection is performed. Default queue is non-blocking with size 4.

property outputImage

Outputs image frame with detected edges

setMaxOutputFrameSize(self: depthai.node.EdgeDetector, arg0: int)None

Specify maximum size of output image.

Parameter maxFrameSize:

Maximum frame size in bytes

setNumFramesPool(self: depthai.node.EdgeDetector, arg0: int)None

Specify number of frames in pool.

Parameter numFramesPool:

How many frames should the pool have

setWaitForConfigInput(self: depthai.node.EdgeDetector, arg0: bool)None

Specify whether or not wait until configuration message arrives to inputConfig Input.

Parameter wait:

True to wait for configuration message, false otherwise.

class dai::node::EdgeDetector : public dai::Node

EdgeDetector node. Performs edge detection using 3x3 Sobel filter.

Public Types

using Properties = dai::EdgeDetectorProperties

Public Functions

EdgeDetector(const std::shared_ptr<PipelineImpl> &par, int64_t nodeId)
void setWaitForConfigInput(bool wait)

Specify whether or not wait until configuration message arrives to inputConfig Input.

Parameters
  • wait: True to wait for configuration message, false otherwise.

void setNumFramesPool(int numFramesPool)

Specify number of frames in pool.

Parameters
  • numFramesPool: How many frames should the pool have

void setMaxOutputFrameSize(int maxFrameSize)

Specify maximum size of output image.

Parameters
  • maxFrameSize: Maximum frame size in bytes

Public Members

EdgeDetectorConfig initialConfig

Initial config to use for edge detection.

Input inputConfig = {*this, "inputConfig", Input::Type::SReceiver, false, 4, {{DatatypeEnum::EdgeDetectorConfig, false}}}

Input EdgeDetectorConfig message with ability to modify parameters in runtime. Default queue is non-blocking with size 4.

Input inputImage = {*this, "inputImage", Input::Type::SReceiver, false, 4, {{DatatypeEnum::ImgFrame, false}}}

Input image on which edge detection is performed. Default queue is non-blocking with size 4.

Output outputImage = {*this, "outputImage", Output::Type::MSender, {{DatatypeEnum::ImgFrame, false}}}

Outputs image frame with detected edges

Output passthroughInputImage = {*this, "passthroughInputImage", Output::Type::MSender, {{DatatypeEnum::ImgFrame, false}}}

Passthrough message on which the calculation was performed.

Private Functions

std::string getName() const override

Retrieves nodes name.

nlohmann::json getProperties() override
std::shared_ptr<Node> clone() override

Private Members

std::shared_ptr<RawEdgeDetectorConfig> rawConfig
Properties properties

Got questions?

We’re always happy to help with code or other questions you might have.