Skip to content

Instantly share code, notes, and snippets.

@devyhia
Last active June 29, 2019 11:10
Show Gist options
  • Save devyhia/315125332e84a81e94f4de867efbefaa to your computer and use it in GitHub Desktop.
Save devyhia/315125332e84a81e94f4de867efbefaa to your computer and use it in GitHub Desktop.
function [] = plotPointsAndBones(img, pose)
% pose.openpose_keypoints{index} should correspond to a Struct of the following format:
% {
% "x": x,
% "y": y,
% "c": confidence,
% "point_label": OpenPoseMap[point_index],
% "point_index": point_index,
% }
pointsOfInterest = getPointsOfInterest();
bonesOfInterest = getBonesOfInterest();
% Plot the image
imshow(img);
hold on;
% Draw the points of interest
for i=1:1:length(pointsOfInterest)
index = triangulationPoints(i) + 1
scatter(pose.openpose_keypoints{index}.x, pose.openpose_keypoints{index}.y, 100, 'filled', 'LineWidth', 100)
end
K = pose.openpose_keypoints;
% Draw bone structure
for i=1:1:length(bonesOfInterest)
p1 = bonesOfInterest(i, 1) + 1;
p2 = bonesOfInterest(i, 2) + 1;
plot([ K{p1}.x; K{p2}.x ], [ K{p1}.y; K{p2}.y ], 'LineWidth', 3.5);
end
hold off;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment