pptinypose_utils.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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 "ultra_infer/vision/utils/utils.h"
  16. namespace ultra_infer {
  17. namespace vision {
  18. namespace keypointdetection {
  19. cv::Point2f Get3dPoint(const cv::Point2f &a, const cv::Point2f &b);
  20. std::vector<float> GetDir(const float src_point_x, const float src_point_y,
  21. const float rot_rad);
  22. void GetAffineTransform(const std::vector<float> &center,
  23. const std::vector<float> &scale, const float rot,
  24. const std::vector<int> &output_size, cv::Mat *trans,
  25. const int inv);
  26. void AffineTransform(const float pt_x, const float pt_y, const cv::Mat &trans,
  27. std::vector<float> *preds, const int p);
  28. void TransformPreds(std::vector<float> &coords,
  29. const std::vector<float> &center,
  30. const std::vector<float> &scale,
  31. const std::vector<int> &output_size,
  32. const std::vector<int> &dim,
  33. std::vector<float> *target_coords);
  34. void GetFinalPredictions(const std::vector<float> &heatmap,
  35. const std::vector<int> &dim,
  36. const std::vector<int64_t> &idxout,
  37. const std::vector<float> &center,
  38. const std::vector<float> scale,
  39. std::vector<float> *preds, const bool DARK);
  40. } // namespace keypointdetection
  41. } // namespace vision
  42. } // namespace ultra_infer