MCPcopy Create free account
hub / github.com/OpenShot/libopenshot / AddFrameDataToProto

Method AddFrameDataToProto

src/CVObjectDetection.cpp:338–356  ·  view source on GitHub ↗

Add frame object detection into protobuf message.

Source from the content-addressed store, hash-verified

336
337// Add frame object detection into protobuf message.
338void CVObjectDetection::AddFrameDataToProto(pb_objdetect::Frame* pbFrameData, CVDetectionData& dData) {
339
340 // Save frame number and rotation
341 pbFrameData->set_id(dData.frameId);
342
343 for(size_t i = 0; i < dData.boxes.size(); i++){
344 pb_objdetect::Frame_Box* box = pbFrameData->add_bounding_box();
345
346 // Save bounding box data
347 box->set_x(dData.boxes.at(i).x);
348 box->set_y(dData.boxes.at(i).y);
349 box->set_w(dData.boxes.at(i).width);
350 box->set_h(dData.boxes.at(i).height);
351 box->set_classid(dData.classIds.at(i));
352 box->set_confidence(dData.confidences.at(i));
353 box->set_objectid(dData.objectIds.at(i));
354
355 }
356}
357
358// Load JSON string into this object
359void CVObjectDetection::SetJson(const std::string value) {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected