keypoint_postprocess.h 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  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 <opencv2/core/core.hpp>
  16. #include <opencv2/highgui/highgui.hpp>
  17. #include <opencv2/imgproc/imgproc.hpp>
  18. #include <vector>
  19. std::vector<float> get_3rd_point(std::vector<float>& a, std::vector<float>& b);
  20. std::vector<float> get_dir(float src_point_x, float src_point_y, float rot_rad);
  21. void affine_tranform(
  22. float pt_x, float pt_y, cv::Mat& trans, std::vector<float>& preds, int p);
  23. cv::Mat get_affine_transform(std::vector<float>& center,
  24. std::vector<float>& scale,
  25. float rot,
  26. std::vector<int>& output_size,
  27. int inv);
  28. void transform_preds(std::vector<float>& coords,
  29. std::vector<float>& center,
  30. std::vector<float>& scale,
  31. std::vector<int>& output_size,
  32. std::vector<int>& dim,
  33. std::vector<float>& target_coords);
  34. void box_to_center_scale(std::vector<int>& box,
  35. int width,
  36. int height,
  37. std::vector<float>& center,
  38. std::vector<float>& scale);
  39. void get_max_preds(float* heatmap,
  40. std::vector<int>& dim,
  41. std::vector<float>& preds,
  42. float* maxvals,
  43. int batchid,
  44. int joint_idx);
  45. void get_final_preds(std::vector<float>& heatmap,
  46. std::vector<int>& dim,
  47. std::vector<int64_t>& idxout,
  48. std::vector<int>& idxdim,
  49. std::vector<float>& center,
  50. std::vector<float> scale,
  51. std::vector<float>& preds,
  52. int batchid,
  53. bool DARK = true);