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
inputImage- ImgFrameinputConfig- EdgeDetectorConfigoutputImage- ImgFrame
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.
getAssetManager(self: depthai.Node) -> depthai.AssetManager
Get node AssetManager as a const reference
getAssetManager(self: depthai.Node) -> depthai.AssetManager
Get node AssetManager as a const reference
-
getInputRefs(*args, **kwargs) Overloaded function.
getInputRefs(self: depthai.Node) -> List[depthai.Node.Input]
Retrieves reference to node inputs
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.
getOutputRefs(self: depthai.Node) -> List[depthai.Node.Output]
Retrieves reference to node outputs
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.
getParentPipeline(self: depthai.Node) -> depthai.Pipeline
getParentPipeline(self: depthai.Node) -> depthai.Pipeline
-
getWaitForConfigInput(self: depthai.node.EdgeDetector) → bool See also
setWaitForConfigInput
- Returns
True if wait for inputConfig message, false otherwise
-
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
- Parameter
-
setNumFramesPool(self: depthai.node.EdgeDetector, arg0: int) → None Specify number of frames in pool.
- Parameter
numFramesPool: How many frames should the pool have
- Parameter
-
setWaitForConfigInput(self: depthai.node.EdgeDetector, wait: bool) → None Specify whether or not wait until configuration message arrives to inputConfig Input.
- Parameter
wait: True to wait for configuration message, false otherwise.
- Parameter
-
class
-
class
dai::node::EdgeDetector: public dai::NodeCRTP<Node, EdgeDetector, EdgeDetectorProperties>¶ EdgeDetector node. Performs edge detection using 3x3 Sobel filter.
Public Functions
-
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
- 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
-
constexpr const char *
NAME= "EdgeDetector"¶
Private Members
-
std::shared_ptr<RawEdgeDetectorConfig>
rawConfig¶
-
void
Got questions?
We’re always happy to help with code or other questions you might have.