postprocess.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. // Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved.
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. #pragma once
  15. #include <glog/logging.h>
  16. #include <ctime>
  17. #include <memory>
  18. #include <set>
  19. #include <string>
  20. #include <utility>
  21. #include <vector>
  22. #include <opencv2/core/core.hpp>
  23. #include <opencv2/highgui/highgui.hpp>
  24. #include <opencv2/imgproc/imgproc.hpp>
  25. #include "include/utils.h"
  26. namespace PaddleDetection {
  27. // Generate visualization color
  28. cv::Scalar GetColor(int idx);
  29. // Visualize Tracking Results
  30. cv::Mat VisualizeTrackResult(const cv::Mat& img,
  31. const MOTResult& results,
  32. const float fps,
  33. const int frame_id);
  34. // Pedestrian/Vehicle Counting
  35. void FlowStatistic(const MOTResult& results,
  36. const int frame_id,
  37. const int secs_interval,
  38. const bool do_entrance_counting,
  39. const int video_fps,
  40. const Rect entrance,
  41. std::set<int>* id_set,
  42. std::set<int>* interval_id_set,
  43. std::vector<int>* in_id_list,
  44. std::vector<int>* out_id_list,
  45. std::map<int, std::vector<float>>* prev_center,
  46. std::vector<std::string>* records);
  47. // Save Tracking Results
  48. void SaveMOTResult(const MOTResult& results,
  49. const int frame_id,
  50. std::vector<std::string>* records);
  51. } // namespace PaddleDetection