如何放置
Python
Python
1with dai.Pipeline() as pipeline:
2 gate = pipeline.create(dai.node.Gate)输入和输出
用法
Python
Python
1with dai.Pipeline(device) as pipeline:
2 camera = pipeline.create(dai.node.Camera).build()
3 cameraOut = camera.requestOutput((640, 400), fps=30)
4
5 gate = pipeline.create(dai.node.Gate)
6 cameraOut.link(gate.input)
7 cameraQueue = gate.output.createOutputQueue()
8 gateControlQueue = gate.inputControl.createInputQueue()
9
10 gateControl = dai.GateControl()
11
12 pipeline.start()
13
14 startTime = time.monotonic()
15 gateOpen = True
16
17 # Open gate every odd second and close every even second
18 while pipeline.isRunning():
19 currentTime = time.monotonic()
20 if (startTime-currentTime) % 2 == 0:
21 if not gateOpen:
22 gateControlQueue.send(dai.GateControl.openGate())
23 openGate = True
24 else:
25 if gateOpen:
26 gateControlQueue.send(dai.GateControl.closeGate())
27 gateOpen = False功能示例
- Gate 示例 - 每 n 秒打开和关闭流门。
参考
class
dai::node::Gate
variable
std::shared_ptr< GateControl > initialConfig
variable
Input input
variable
Output output
Main data output.
- Forwards messages that were allowed through the Gate. The data type matches the input message.
variable
Input inputControl
Control input.
- Accepts 'GateControl' messages to dynamically change the Gate's state. Use this to Open/Close the gate or set it to pass a specific number of frames at runtime.
- Default queue size: 4
function
Gate(std::unique_ptr< Properties > props)function
Gate()function
void setRunOnHost(bool runOnHost)Specify whether to run on host or device By default, the node will run on device.
function
bool runOnHost()Check if the node is configured to run on the host.
Returns
true if running on host, false otherwise.
function
void run()inline function
DeviceNodeCRTP()inline function
DeviceNodeCRTP(const std::shared_ptr< Device > & device)inline function
DeviceNodeCRTP(std::unique_ptr< Properties > props)inline function
DeviceNodeCRTP(std::unique_ptr< Properties > props, bool confMode)inline function
DeviceNodeCRTP(const std::shared_ptr< Device > & device, std::unique_ptr< Properties > props, bool confMode)需要帮助?
请访问讨论论坛以获取技术支持或您可能有的任何其他问题。