analyzeNode.cpp 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. #include "nodes/base/base.hpp"
  2. #include "nodes/analyze/analyzeNode.hpp"
  3. namespace StreamNode
  4. {
  5. void AnalyzeNode::work()
  6. {
  7. printf("AnalyzeNode %s\n", name_.c_str());
  8. while (running_)
  9. {
  10. for (auto& input_buffer : input_buffers_)
  11. {
  12. std::shared_ptr<meta::MetaData> metaData;
  13. if (!input_buffer.second->try_pop(metaData))
  14. {
  15. continue;
  16. }
  17. // printf("Node %s get data from %s\n", name_.c_str(), input_buffer.first.c_str());
  18. int width = metaData->image.cols;
  19. int height = metaData->image.rows;
  20. auto boxes = metaData->boxes;
  21. for (auto& box : boxes)
  22. {
  23. // 将分析的结果存入到 metaData->result 中
  24. }
  25. metaData->result = boxes;
  26. for (auto& output_buffer : output_buffers_)
  27. {
  28. // printf("Node %s push data to %s\n", name_.c_str(), output_buffer.first.c_str());
  29. output_buffer.second->push(metaData);
  30. }
  31. }
  32. }
  33. }
  34. } // namespace Node