Go to the documentation of this file.
9 int main(
int argc,
char** argv) {
13 std::string nnPath(BLOB_PATH);
17 nnPath = std::string(argv[1]);
21 printf(
"Using blob at path: %s\n", nnPath.c_str());
31 camRgb->setInterleaved(
false);
32 camRgb->setPreviewSize(300, 300);
36 nn->setNumInferenceThreads(2);
40 # Run script only once
42 # output = (input - mean) / scale
44 # This configuration will subtract all frame values (pixels) by 127.5
45 # 0.0 .. 255.0 -> -127.5 .. 127.5
47 data.setLayer("mean", [127.5])
48 node.io['mean'].send(data)
50 # This configuration will divide all frame values (pixels) by 255.0
51 # -127.5 .. 127.5 -> -0.5 .. 0.5
53 data.setLayer("scale", [255.0])
54 node.io['scale'].send(data)
57 script->outputs[
"mean"].link(nn->inputs[
"mean"]);
58 nn->inputs[
"mean"].setWaitForMessage(
false);
60 script->outputs[
"scale"].link(nn->inputs[
"scale"]);
61 nn->inputs[
"scale"].setWaitForMessage(
false);
63 camRgb->preview.link(nn->inputs[
"frame"]);
67 nn->out.link(xout->input);
78 cv::imshow(
"Original Frame",
fromPlanarFp16(inNn->getFirstLayerFp16(), 300, 300, 127.5, 255.0));
80 int key = cv::waitKey(1);
81 if(key ==
'q' || key ==
'Q') {
XLinkOut node. Sends messages over XLink.
Represents the pipeline, set of nodes and connections between them.
ColorCamera node. For use with color sensors.
NeuralNetwork node. Runs a neural inference on input data.
std::shared_ptr< DataOutputQueue > getOutputQueue(const std::string &name)
void setOpenVINOVersion(OpenVINO::Version version)
Set a specific OpenVINO version to use with this pipeline.
void setScript(const std::string &script, const std::string &name="")
std::shared_ptr< N > create()
void setBlobPath(const dai::Path &path)
void setFp16(bool fp16)
Set fp16 (0..255) data type of preview output frames.
cv::Mat fromPlanarFp16(const std::vector< float > &data, int w, int h, float mean, float scale)
void setStreamName(const std::string &name)
depthai
Author(s): Martin Peterlin
autogenerated on Sat Mar 22 2025 02:58:19