(self, results)
| 219 | self.use_udp = use_udp |
| 220 | |
| 221 | def __call__(self, results): |
| 222 | image_size = results['ann_info']['image_size'] |
| 223 | |
| 224 | img = results['image'] |
| 225 | joints_3d = results['joints_3d'] |
| 226 | joints_3d_visible = results['joints_3d_visible'] |
| 227 | c = results['center'] |
| 228 | s = results['scale'] |
| 229 | r = results['rotation'] |
| 230 | |
| 231 | if self.use_udp: |
| 232 | trans = get_warp_matrix(r, c * 2.0, image_size - 1.0, s * 200.0) |
| 233 | img = cv2.warpAffine( |
| 234 | img, |
| 235 | trans, (int(image_size[0]), int(image_size[1])), |
| 236 | flags=cv2.INTER_LINEAR) |
| 237 | joints_3d[:, 0:2] = \ |
| 238 | warp_affine_joints(joints_3d[:, 0:2].copy(), trans) |
| 239 | else: |
| 240 | trans = get_affine_transform(c, s, r, image_size) |
| 241 | img = cv2.warpAffine( |
| 242 | img, |
| 243 | trans, (int(image_size[0]), int(image_size[1])), |
| 244 | flags=cv2.INTER_LINEAR) |
| 245 | for i in range(results['ann_info']['num_joints']): |
| 246 | if joints_3d_visible[i, 0] > 0.0: |
| 247 | joints_3d[i, |
| 248 | 0:2] = affine_transform(joints_3d[i, 0:2], trans) |
| 249 | |
| 250 | results['image'] = img |
| 251 | results['joints_3d'] = joints_3d |
| 252 | results['joints_3d_visible'] = joints_3d_visible |
| 253 | |
| 254 | return results |
| 255 | |
| 256 | class ToTensor: |
| 257 | """Transform image to Tensor. |
nothing calls this directly
no test coverage detected