MCPcopy Create free account
hub / github.com/3DAnimals/3DAnimals / crop_keypoints

Function crop_keypoints

evaluation/evaluate.py:174–189  ·  view source on GitHub ↗
(kp, name, data_dir, box_postfix)

Source from the content-addressed store, hash-verified

172
173
174def crop_keypoints(kp, name, data_dir, box_postfix):
175 kp = kp.copy()
176
177 # load our bbox
178 box_path = Path(data_dir) / (name + box_postfix)
179 # id, xmin, ymin, w, h, full w, full h, sharpness
180 box_xmin, box_ymin, box_w, box_h = np.loadtxt(box_path)[1:5]
181
182 # crop the original keypoints
183 kp[:, 0] -= box_xmin
184 kp[:, 1] -= box_ymin
185 # scale keypoints to [-1, 1]
186 kp[:, 0] = kp[:, 0] / box_w * 2 - 1
187 kp[:, 1] = kp[:, 1] / box_h * 2 - 1
188
189 return kp
190
191
192def crop_keypoints_with_box(kp, box):

Callers 1

load_keypointsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected