Renamed a parameter.
This commit is contained in:
@ -4,9 +4,9 @@
|
|||||||
// =================================================================================================
|
// =================================================================================================
|
||||||
// =================================================================================================
|
// =================================================================================================
|
||||||
|
|
||||||
Triangulator::Triangulator(float min_score, size_t min_group_size)
|
Triangulator::Triangulator(float min_match_score, size_t min_group_size)
|
||||||
{
|
{
|
||||||
this->triangulator = new TriangulatorInternal(min_score, min_group_size);
|
this->triangulator = new TriangulatorInternal(min_match_score, min_group_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
// =================================================================================================
|
// =================================================================================================
|
||||||
|
|||||||
@ -19,11 +19,11 @@ public:
|
|||||||
* Triangulator to predict poses from multiple views.
|
* Triangulator to predict poses from multiple views.
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* @param min_score Minimum score to consider a triangulated joint as valid.
|
* @param min_match_score Minimum score to consider a triangulated joint as valid.
|
||||||
* @param min_group_size Minimum number of camera pairs that need to see a person.
|
* @param min_group_size Minimum number of camera pairs that need to see a person.
|
||||||
*/
|
*/
|
||||||
Triangulator(
|
Triangulator(
|
||||||
float min_score = 0.95,
|
float min_match_score = 0.95,
|
||||||
size_t min_group_size = 1);
|
size_t min_group_size = 1);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -102,9 +102,9 @@ void CameraInternal::update_projection_matrix()
|
|||||||
// =================================================================================================
|
// =================================================================================================
|
||||||
// =================================================================================================
|
// =================================================================================================
|
||||||
|
|
||||||
TriangulatorInternal::TriangulatorInternal(float min_score, size_t min_group_size)
|
TriangulatorInternal::TriangulatorInternal(float min_match_score, size_t min_group_size)
|
||||||
{
|
{
|
||||||
this->min_score = min_score;
|
this->min_match_score = min_match_score;
|
||||||
this->min_group_size = min_group_size;
|
this->min_group_size = min_group_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -241,7 +241,7 @@ std::vector<std::vector<std::array<float, 4>>> TriangulatorInternal::triangulate
|
|||||||
stime = std::chrono::high_resolution_clock::now();
|
stime = std::chrono::high_resolution_clock::now();
|
||||||
|
|
||||||
// Check matches to old poses
|
// Check matches to old poses
|
||||||
float threshold = min_score - 0.2;
|
float threshold = min_match_score - 0.2;
|
||||||
std::map<size_t, std::map<size_t, std::vector<size_t>>> scored_pasts;
|
std::map<size_t, std::map<size_t, std::vector<size_t>>> scored_pasts;
|
||||||
if (!last_poses_3d.empty())
|
if (!last_poses_3d.empty())
|
||||||
{
|
{
|
||||||
@ -447,7 +447,7 @@ std::vector<std::vector<std::array<float, 4>>> TriangulatorInternal::triangulate
|
|||||||
size_t num_poses = all_scored_poses.size();
|
size_t num_poses = all_scored_poses.size();
|
||||||
for (size_t i = num_poses; i > 0; --i)
|
for (size_t i = num_poses; i > 0; --i)
|
||||||
{
|
{
|
||||||
if (all_scored_poses[i - 1].second < min_score)
|
if (all_scored_poses[i - 1].second < min_match_score)
|
||||||
{
|
{
|
||||||
all_scored_poses.erase(all_scored_poses.begin() + i - 1);
|
all_scored_poses.erase(all_scored_poses.begin() + i - 1);
|
||||||
all_pairs.erase(all_pairs.begin() + i - 1);
|
all_pairs.erase(all_pairs.begin() + i - 1);
|
||||||
@ -456,7 +456,7 @@ std::vector<std::vector<std::array<float, 4>>> TriangulatorInternal::triangulate
|
|||||||
|
|
||||||
// Group pairs that share a person
|
// Group pairs that share a person
|
||||||
std::vector<std::tuple<cv::Point3f, cv::Mat, std::vector<int>>> groups;
|
std::vector<std::tuple<cv::Point3f, cv::Mat, std::vector<int>>> groups;
|
||||||
groups = calc_grouping(all_pairs, all_scored_poses, min_score);
|
groups = calc_grouping(all_pairs, all_scored_poses, min_match_score);
|
||||||
|
|
||||||
// Drop groups with too few matches
|
// Drop groups with too few matches
|
||||||
size_t num_groups = groups.size();
|
size_t num_groups = groups.size();
|
||||||
@ -508,7 +508,7 @@ std::vector<std::vector<std::array<float, 4>>> TriangulatorInternal::triangulate
|
|||||||
poses.push_back(all_full_poses[idx]);
|
poses.push_back(all_full_poses[idx]);
|
||||||
}
|
}
|
||||||
|
|
||||||
auto merged_pose = merge_group(poses, min_score);
|
auto merged_pose = merge_group(poses, min_match_score);
|
||||||
all_merged_poses[i] = (merged_pose);
|
all_merged_poses[i] = (merged_pose);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -548,7 +548,7 @@ std::vector<std::vector<std::array<float, 4>>> TriangulatorInternal::triangulate
|
|||||||
}
|
}
|
||||||
pose.push_back(point);
|
pose.push_back(point);
|
||||||
|
|
||||||
if (point[3] > min_score)
|
if (point[3] > min_match_score)
|
||||||
{
|
{
|
||||||
num_valid++;
|
num_valid++;
|
||||||
}
|
}
|
||||||
@ -1860,7 +1860,7 @@ void TriangulatorInternal::add_missing_joints(
|
|||||||
for (size_t j = 0; j < num_joints; ++j)
|
for (size_t j = 0; j < num_joints; ++j)
|
||||||
{
|
{
|
||||||
float *pose_ptr = pose.ptr<float>(j);
|
float *pose_ptr = pose.ptr<float>(j);
|
||||||
if (pose_ptr[3] > min_score)
|
if (pose_ptr[3] > min_match_score)
|
||||||
{
|
{
|
||||||
valid_joint_idx.push_back(j);
|
valid_joint_idx.push_back(j);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -31,7 +31,7 @@ public:
|
|||||||
class TriangulatorInternal
|
class TriangulatorInternal
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
TriangulatorInternal(float min_score, size_t min_group_size);
|
TriangulatorInternal(float min_match_score, size_t min_group_size);
|
||||||
|
|
||||||
std::vector<std::vector<std::array<float, 4>>> triangulate_poses(
|
std::vector<std::vector<std::array<float, 4>>> triangulate_poses(
|
||||||
const std::vector<std::vector<std::vector<std::array<float, 3>>>> &poses_2d,
|
const std::vector<std::vector<std::vector<std::array<float, 3>>>> &poses_2d,
|
||||||
@ -43,7 +43,7 @@ public:
|
|||||||
void print_stats();
|
void print_stats();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
float min_score;
|
float min_match_score;
|
||||||
float min_group_size;
|
float min_group_size;
|
||||||
|
|
||||||
const std::vector<std::string> core_joints = {
|
const std::vector<std::string> core_joints = {
|
||||||
|
|||||||
@ -281,7 +281,9 @@ def main():
|
|||||||
all_poses = []
|
all_poses = []
|
||||||
all_ids = []
|
all_ids = []
|
||||||
times = []
|
times = []
|
||||||
triangulator = rpt.Triangulator(min_score=minscore, min_group_size=min_group_size)
|
triangulator = rpt.Triangulator(
|
||||||
|
min_match_score=minscore, min_group_size=min_group_size
|
||||||
|
)
|
||||||
old_scene = ""
|
old_scene = ""
|
||||||
old_index = -1
|
old_index = -1
|
||||||
for label in tqdm.tqdm(labels):
|
for label in tqdm.tqdm(labels):
|
||||||
|
|||||||
@ -340,7 +340,7 @@ def main():
|
|||||||
else:
|
else:
|
||||||
cameras = rpt.convert_cameras(camparams)
|
cameras = rpt.convert_cameras(camparams)
|
||||||
roomp = [roomparams["room_size"], roomparams["room_center"]]
|
roomp = [roomparams["room_size"], roomparams["room_center"]]
|
||||||
triangulator = rpt.Triangulator(min_score=0.95)
|
triangulator = rpt.Triangulator(min_match_score=0.95)
|
||||||
|
|
||||||
stime = time.time()
|
stime = time.time()
|
||||||
poses_3d = triangulator.triangulate_poses(
|
poses_3d = triangulator.triangulate_poses(
|
||||||
|
|||||||
@ -60,7 +60,7 @@ def main():
|
|||||||
cameras = rpt.convert_cameras(cams)
|
cameras = rpt.convert_cameras(cams)
|
||||||
|
|
||||||
# Run triangulation
|
# Run triangulation
|
||||||
triangulator = rpt.Triangulator(min_score=0.95)
|
triangulator = rpt.Triangulator(min_match_score=0.95)
|
||||||
stime = time.time()
|
stime = time.time()
|
||||||
poses_3d = triangulator.triangulate_poses(
|
poses_3d = triangulator.triangulate_poses(
|
||||||
poses_2d, cameras, roomparams, joint_names
|
poses_2d, cameras, roomparams, joint_names
|
||||||
|
|||||||
Reference in New Issue
Block a user