# EdgeDetector

边缘检测器使用 [Sobel 算子](https://en.wikipedia.org/wiki/Sobel_operator) 创建突出边缘的图像。

## 放置方式

#### Python

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

#### C++

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

## 输入与输出

## 使用方法

#### 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);
```

## 功能示例

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

## 参考资料

### 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

### 需要帮助？

请前往 [OAKChina 官网](https://www.oakchina.cn/) 获取技术支持或解答您的任何疑问。
