keypoint_postprocess.h 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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<uint64_t>& output_size,
  36. std::vector<int>& dim,
  37. std::vector<float>& target_coords,
  38. bool affine);
  39. void box_to_center_scale(std::vector<int>& box,
  40. int width,
  41. int height,
  42. std::vector<float>& center,
  43. std::vector<float>& scale);
  44. void get_max_preds(std::vector<float>& heatmap,
  45. std::vector<int>& dim,
  46. std::vector<float>& preds,
  47. std::vector<float>& maxvals,
  48. int batchid,
  49. int joint_idx);
  50. void get_final_preds(std::vector<float>& heatmap,
  51. std::vector<uint64_t>& dim,
  52. std::vector<float>& idxout,
  53. std::vector<uint64_t>& idxdim,
  54. std::vector<float>& center,
  55. std::vector<float> scale,
  56. std::vector<float>& preds,
  57. int batchid,
  58. bool DARK = true);
  59. void CropImg(cv::Mat& img,
  60. cv::Mat& crop_img,
  61. std::vector<int>& area,
  62. std::vector<float>& center,
  63. std::vector<float>& scale,
  64. float expandratio = 0.25);