MCPcopy Index your code
hub / github.com/tensorflow/tfjs-models / drawSkeleton

Function drawSkeleton

shared/test_util.ts:170–187  ·  view source on GitHub ↗
(
    keypoints: Keypoint[], skeletonAdjacentPairs: number[][],
    ctx: CanvasRenderingContext2D, color: string)

Source from the content-addressed store, hash-verified

168}
169
170function drawSkeleton(
171 keypoints: Keypoint[], skeletonAdjacentPairs: number[][],
172 ctx: CanvasRenderingContext2D, color: string) {
173 ctx.fillStyle = color;
174 ctx.strokeStyle = color;
175 ctx.lineWidth = 2;
176
177 for (const pair of skeletonAdjacentPairs) {
178 const [i, j] = pair;
179 const kp1 = keypoints[i];
180 const kp2 = keypoints[j];
181
182 ctx.beginPath();
183 ctx.moveTo(kp1.x, kp1.y);
184 ctx.lineTo(kp2.x, kp2.y);
185 ctx.stroke();
186 }
187}
188
189function draw(
190 keypoints: Keypoint[], ctx: CanvasRenderingContext2D,

Callers 1

drawFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected