| 48 | |
| 49 | |
| 50 | def create_empty_df(dataframe, scorer, flag): |
| 51 | # Creates an empty dataFrame of same shape as df_side_view |
| 52 | # flag = 2d or 3d |
| 53 | |
| 54 | df = dataframe |
| 55 | bodyparts = df.columns.get_level_values("bodyparts").unique() |
| 56 | a = np.full((df.shape[0], 3), np.nan) |
| 57 | dataFrame = None |
| 58 | for bodypart in bodyparts: |
| 59 | if flag == "2d": |
| 60 | pdindex = pd.MultiIndex.from_product( |
| 61 | [[scorer], [bodypart], ["x", "y", "likelihood"]], |
| 62 | names=["scorer", "bodyparts", "coords"], |
| 63 | ) |
| 64 | elif flag == "3d": |
| 65 | pdindex = pd.MultiIndex.from_product( |
| 66 | [[scorer], [bodypart], ["x", "y", "z"]], |
| 67 | names=["scorer", "bodyparts", "coords"], |
| 68 | ) |
| 69 | frame = pd.DataFrame(a, columns=pdindex, index=range(0, df.shape[0])) |
| 70 | dataFrame = pd.concat([frame, dataFrame], axis=1) |
| 71 | return (dataFrame, scorer, bodyparts) |
| 72 | |
| 73 | |
| 74 | def compute_triangulation_calibration_images( |