Hey there,
I’m working on a basic body tracking script and am trying to get the tracking state of my bodies. For that I adapted the samples and got the following script. However, I always end up in “else” because I seem to call the tracking state wrong. Does anyone have an idea what I don’t see?
if (bodies.is_new) {
if (!bodies.object_list.empty()) {
for (auto object : bodies.object_list)
joint_nr = 0;
cout << bones_pos << endl;
OBJECT_TRACKING_STATE object_tracking_state = object.tracking_state;
if (object_tracking_state == OBJECT_TRACKING_STATE::OK) {
for (auto& kp_3d : object.keypoint)
bones_pos = "1/" + to_string(object.id) + "/" + to_string(kp_3d.x) + "/" + to_string(kp_3d.y) + "/" + to_string(kp_3d.z) + "/" + to_string(joint_nr);
cout << bones_pos << endl;
joint_nr = joint_nr + 1;
}
else if (object_tracking_state == OBJECT_TRACKING_STATE::TERMINATE) {
for (auto& kp_3d : object.keypoint)
bones_pos = "0/" + to_string(object.id) + "/" + to_string(kp_3d.x) + "/" + to_string(kp_3d.y) + "/" + to_string(kp_3d.z) + "/" + to_string(joint_nr);
cout << bones_pos << endl;
}
else if (object.tracking_state == OBJECT_TRACKING_STATE::SEARCHING) {
for (auto& kp_3d : object.keypoint)
bones_pos = "2/" + to_string(object.id) + "/" + to_string(kp_3d.x) + "/" + to_string(kp_3d.y) + "/" + to_string(kp_3d.z) + "/" + to_string(joint_nr);
cout << bones_pos << endl;
}
else {
bones_pos = "3/";
cout << bones_pos << endl;
}
}
}