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
class Id

Node identificator. Unique for every node on a single Pipeline

getAssetManager(*args, **kwargs)

Overloaded function.

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

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

getInputRefs(*args, **kwargs)

Overloaded function.

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

  2. getInputRefs(self: depthai.Node) -> list[depthai.Node.Input]

getInputs(self: depthai.Node)list[depthai.Node.Input]
getName(self: depthai.Node)str
getOutputRefs(*args, **kwargs)

Overloaded function.

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

  2. getOutputRefs(self: depthai.Node) -> list[depthai.Node.Output]

getOutputs(self: depthai.Node)list[depthai.Node.Output]
getParentPipeline(*args, **kwargs)

Overloaded function.

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

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

getWaitForConfigInput(self: depthai.node.EdgeDetector)bool
setMaxOutputFrameSize(self: depthai.node.EdgeDetector, arg0: int)None
setNumFramesPool(self: depthai.node.EdgeDetector, arg0: int)None
setWaitForConfigInput(self: depthai.node.EdgeDetector, wait: bool)None
class dai::node::EdgeDetector : public dai::NodeCRTP<Node, EdgeDetector, EdgeDetectorProperties>

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

Public Functions

EdgeDetector(const std::shared_ptr<PipelineImpl> &par, int64_t nodeId)
EdgeDetector(const std::shared_ptr<PipelineImpl> &par, int64_t nodeId, std::unique_ptr<Properties> props)
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.

bool getWaitForConfigInput() const

See

setWaitForConfigInput

Return

True if wait for inputConfig 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, true, {{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.

Public Static Attributes

static constexpr const char *NAME = "EdgeDetector"

Private Members

std::shared_ptr<RawEdgeDetectorConfig> rawConfig

Got questions?

Head over to Discussion Forum for technical support or any other questions you might have.