keypoint_postprocess.h 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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>& x, int p, int num);
  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(std::vector<float>& heatmap,
  40. std::vector<int64_t>& dim,
  41. std::vector<float>& preds,
  42. std::vector<float>& maxvals,
  43. int batchid,
  44. int joint_idx);
  45. void get_final_preds(std::vector<float>& heatmap,
  46. std::vector<int64_t>& dim,
  47. std::vector<int64_t>& idxout,
  48. std::vector<int64_t>& idxdim,
  49. std::vector<float>& center,
  50. std::vector<float> scale,
  51. std::vector<float>& preds,
  52. int batchid,
  53. bool DARK = true);