keypoint_postprocess.h 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. // Copyright (c) 2022 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(float pt_x,
  22. float pt_y,
  23. cv::Mat& trans,
  24. std::vector<float>& x,
  25. int p,
  26. int num);
  27. cv::Mat get_affine_transform(std::vector<float>& center,
  28. std::vector<float>& scale,
  29. float rot,
  30. std::vector<int>& output_size,
  31. int inv);
  32. void transform_preds(std::vector<float>& coords,
  33. std::vector<float>& center,
  34. std::vector<float>& scale,
  35. std::vector<int>& output_size,
  36. std::vector<int>& dim,
  37. std::vector<float>& target_coords);
  38. void box_to_center_scale(std::vector<int>& box,
  39. int width,
  40. int height,
  41. std::vector<float>& center,
  42. std::vector<float>& scale);
  43. void get_max_preds(std::vector<float>& heatmap,
  44. std::vector<int>& dim,
  45. std::vector<float>& preds,
  46. std::vector<float>& maxvals,
  47. int batchid,
  48. int joint_idx);
  49. void get_final_preds(std::vector<float>& heatmap,
  50. std::vector<int>& dim,
  51. std::vector<int>& idxout,
  52. std::vector<int>& idxdim,
  53. std::vector<float>& center,
  54. std::vector<float> scale,
  55. std::vector<float>& preds,
  56. int batchid,
  57. bool DARK = true);
  58. void CropImg(cv::Mat& img,
  59. cv::Mat& crop_img,
  60. std::vector<int>& area,
  61. std::vector<float>& center,
  62. std::vector<float>& scale,
  63. float expandratio = 0.25);