MCPcopy Create free account
hub / github.com/ChunelFeng/CGraph / CarDetectorGNode

Class CarDetectorGNode

example/E01-AutoPilot.cpp:100–123  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

98
99
100class CarDetectorGNode : public GNode {
101public:
102 CStatus init() override {
103 conn_id_ = CGRAPH_BIND_MESSAGE_TOPIC(ImageMParam, EXAMPLE_IMAGE_TOPIC, DEFAULT_MESSAGE_BUF_SIZE)
104 return CStatus();
105 }
106
107 CStatus run() override {
108 std::shared_ptr<ImageMParam> image = nullptr;
109 auto status = CGRAPH_SUB_MPARAM(ImageMParam, conn_id_, image);
110 if (status.isErr()) {
111 return status;
112 }
113
114 auto param = CGRAPH_GET_GPARAM_WITH_NO_EMPTY(DetectResultGParam, EXAMPLE_PARAM_KEY);
115 CGRAPH_ECHO("finding car in frame [%d], info is [%s]", image->frame_id_, image->image_buf_);
116 // find car in image.image_buf_ ...
117 param->car_num_ = std::abs((int)std::random_device{}()) % 5;
118 return CStatus();
119 }
120
121private:
122 int conn_id_ = 0;
123};
124
125
126class ShowGNode : public GNode {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected