(c_x, c_y, src_width, src_height, dst_width, dst_height, scale, rot, inv=False)
| 150 | |
| 151 | |
| 152 | def gen_trans_from_patch_cv(c_x, c_y, src_width, src_height, dst_width, dst_height, scale, rot, inv=False): |
| 153 | # augment size with scale |
| 154 | src_w = src_width * scale |
| 155 | src_h = src_height * scale |
| 156 | src_center = np.array([c_x, c_y], dtype=np.float32) |
| 157 | |
| 158 | # augment rotation |
| 159 | rot_rad = np.pi * rot / 180 |
| 160 | src_downdir = rotate_2d(np.array([0, src_h * 0.5], dtype=np.float32), rot_rad) |
| 161 | src_rightdir = rotate_2d(np.array([src_w * 0.5, 0], dtype=np.float32), rot_rad) |
| 162 | |
| 163 | dst_w = dst_width |
| 164 | dst_h = dst_height |
| 165 | dst_center = np.array([dst_w * 0.5, dst_h * 0.5], dtype=np.float32) |
| 166 | dst_downdir = np.array([0, dst_h * 0.5], dtype=np.float32) |
| 167 | dst_rightdir = np.array([dst_w * 0.5, 0], dtype=np.float32) |
| 168 | |
| 169 | src = np.zeros((3, 2), dtype=np.float32) |
| 170 | src[0, :] = src_center |
| 171 | src[1, :] = src_center + src_downdir |
| 172 | src[2, :] = src_center + src_rightdir |
| 173 | |
| 174 | dst = np.zeros((3, 2), dtype=np.float32) |
| 175 | dst[0, :] = dst_center |
| 176 | dst[1, :] = dst_center + dst_downdir |
| 177 | dst[2, :] = dst_center + dst_rightdir |
| 178 | |
| 179 | if inv: |
| 180 | trans = cv2.getAffineTransform(np.float32(dst), np.float32(src)) |
| 181 | else: |
| 182 | trans = cv2.getAffineTransform(np.float32(src), np.float32(dst)) |
| 183 | |
| 184 | trans = trans.astype(np.float32) |
| 185 | return trans |
| 186 | |
| 187 | |
| 188 | def process_db_coord(joint_img, joint_cam, joint_valid, do_flip, img_shape, flip_pairs, img2bb_trans, rot, |
no test coverage detected