# EdgeDetector

Edge detector uses [Sobel filter](https://en.wikipedia.org/wiki/Sobel_operator) to create an image that emphasises edges.

## How to place it

#### Python

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

#### C++

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

## Inputs and Outputs

## Usage

#### Python

```python
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)
```

#### C++

```cpp
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

 * [Edge detector](https://docs.luxonis.com/software-v3/depthai/examples/rvc2/edge_detector/edge_detector.md)

## Reference

### dai::node::EdgeDetector

Kind: class

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

#### std::shared_ptr< EdgeDetectorConfig > initialConfig

Kind: variable

Initial config to use for edge detection.

#### Input inputConfig

Kind: variable

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

#### Input inputImage

Kind: variable

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

#### Output outputImage

Kind: variable

Outputs image frame with detected edges

#### Output passthroughInputImage

Kind: variable

Passthrough message on which the calculation was performed.

#### EdgeDetector()

Kind: function

#### EdgeDetector(std::unique_ptr< Properties > props)

Kind: function

#### void setNumFramesPool(int numFramesPool)

Kind: function

Specify number of frames in pool. parameters: numFramesPool: How many frames should the pool have

#### void setMaxOutputFrameSize(int maxFrameSize)

Kind: function

Specify maximum size of output image. parameters: maxFrameSize: Maximum frame size in bytes

#### DeviceNodeCRTP()

Kind: function

#### DeviceNodeCRTP(const std::shared_ptr< Device > & device)

Kind: function

#### DeviceNodeCRTP(std::unique_ptr< Properties > props)

Kind: function

#### DeviceNodeCRTP(std::unique_ptr< Properties > props, bool confMode)

Kind: function

#### DeviceNodeCRTP(const std::shared_ptr< Device > & device, std::unique_ptr< Properties > props, bool confMode)

Kind: function

### Need assistance?

Head over to [Discussion Forum](https://discuss.luxonis.com/) for technical support or any other questions you might have.
