Replaced cv::mats with nested std::vectors to improve speed.
This commit is contained in:
1233
rpt/triangulator.cpp
1233
rpt/triangulator.cpp
File diff suppressed because it is too large
Load Diff
@ -70,64 +70,76 @@ private:
|
||||
{"shoulder_left", "elbow_left"},
|
||||
{"shoulder_right", "elbow_right"},
|
||||
};
|
||||
std::vector<cv::Mat> last_poses_3d;
|
||||
std::vector<std::vector<std::array<float, 4>>> last_poses_3d;
|
||||
|
||||
void undistort_poses(std::vector<cv::Mat> &poses, CameraInternal &icam);
|
||||
void undistort_poses(
|
||||
std::vector<std::vector<std::array<float, 3>>> &poses_2d, CameraInternal &icam);
|
||||
|
||||
std::tuple<std::vector<cv::Mat>, std::vector<cv::Mat>> project_poses(
|
||||
const std::vector<cv::Mat> &bodies3D, const CameraInternal &icam, bool calc_dists);
|
||||
std::tuple<std::vector<std::vector<std::array<float, 3>>>, std::vector<std::vector<float>>>
|
||||
project_poses(
|
||||
const std::vector<std::vector<std::array<float, 4>>> &poses_3d,
|
||||
const CameraInternal &icam,
|
||||
bool calc_dists);
|
||||
|
||||
float calc_pose_score(
|
||||
const cv::Mat &pose1,
|
||||
const cv::Mat &pose2,
|
||||
const cv::Mat &dist1,
|
||||
const std::vector<std::array<float, 3>> &pose1,
|
||||
const std::vector<std::array<float, 3>> &pose2,
|
||||
const std::vector<float> &dist1,
|
||||
const CameraInternal &icam);
|
||||
|
||||
cv::Mat score_projection(
|
||||
const cv::Mat &pose1,
|
||||
const cv::Mat &repro1,
|
||||
const cv::Mat &dists1,
|
||||
const cv::Mat &mask,
|
||||
std::vector<float> score_projection(
|
||||
const std::vector<std::array<float, 3>> &pose,
|
||||
const std::vector<std::array<float, 3>> &repro,
|
||||
const std::vector<float> &dists,
|
||||
const std::vector<bool> &mask,
|
||||
float iscale);
|
||||
|
||||
std::pair<cv::Mat, float> triangulate_and_score(
|
||||
const cv::Mat &pose1,
|
||||
const cv::Mat &pose2,
|
||||
std::pair<std::vector<std::array<float, 4>>, float> triangulate_and_score(
|
||||
const std::vector<std::array<float, 3>> &pose1,
|
||||
const std::vector<std::array<float, 3>> &pose2,
|
||||
const CameraInternal &cam1,
|
||||
const CameraInternal &cam2,
|
||||
const std::array<std::array<float, 3>, 2> &roomparams,
|
||||
const std::vector<std::array<size_t, 2>> &core_limbs_idx);
|
||||
|
||||
std::vector<std::tuple<cv::Point3f, cv::Mat, std::vector<int>>> calc_grouping(
|
||||
const std::vector<std::pair<std::tuple<int, int, int, int>, std::pair<int, int>>> &all_pairs,
|
||||
const std::vector<std::pair<cv::Mat, float>> &all_scored_poses,
|
||||
std::vector<std::tuple<
|
||||
std::array<float, 3>, std::vector<std::array<float, 4>>, std::vector<int>>>
|
||||
calc_grouping(
|
||||
const std::vector<std::pair<
|
||||
std::tuple<int, int, int, int>, std::pair<int, int>>> &all_pairs,
|
||||
const std::vector<std::pair<std::vector<std::array<float, 4>>, float>> &all_scored_poses,
|
||||
float min_score);
|
||||
|
||||
cv::Mat merge_group(const std::vector<cv::Mat> &poses_3d, float min_score);
|
||||
std::vector<std::array<float, 4>> merge_group(
|
||||
const std::vector<std::vector<std::array<float, 4>>> &poses_3d,
|
||||
float min_score);
|
||||
|
||||
void add_extra_joints(std::vector<cv::Mat> &poses, const std::vector<std::string> &joint_names);
|
||||
void add_extra_joints(
|
||||
std::vector<std::vector<std::array<float, 4>>> &poses,
|
||||
const std::vector<std::string> &joint_names);
|
||||
|
||||
void filter_poses(
|
||||
std::vector<cv::Mat> &poses,
|
||||
std::vector<std::vector<std::array<float, 4>>> &poses,
|
||||
const std::array<std::array<float, 3>, 2> &roomparams,
|
||||
const std::vector<size_t> &core_joint_idx,
|
||||
const std::vector<std::array<size_t, 2>> &core_limbs_idx);
|
||||
|
||||
void add_missing_joints(
|
||||
std::vector<cv::Mat> &poses, const std::vector<std::string> &joint_names);
|
||||
std::vector<std::vector<std::array<float, 4>>> &poses,
|
||||
const std::vector<std::string> &joint_names);
|
||||
|
||||
// Statistics
|
||||
float num_calls = 0;
|
||||
float total_time = 0;
|
||||
float init_time = 0;
|
||||
float undistort_time = 0;
|
||||
float project_time = 0;
|
||||
float match_time = 0;
|
||||
float pairs_time = 0;
|
||||
float pair_scoring_time = 0;
|
||||
float grouping_time = 0;
|
||||
float full_time = 0;
|
||||
float merge_time = 0;
|
||||
float post_time = 0;
|
||||
float convert_time = 0;
|
||||
double num_calls = 0;
|
||||
double total_time = 0;
|
||||
double init_time = 0;
|
||||
double undistort_time = 0;
|
||||
double project_time = 0;
|
||||
double match_time = 0;
|
||||
double pairs_time = 0;
|
||||
double pair_scoring_time = 0;
|
||||
double grouping_time = 0;
|
||||
double full_time = 0;
|
||||
double merge_time = 0;
|
||||
double post_time = 0;
|
||||
double convert_time = 0;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user