Recognizion with multiple
This commit is contained in:
@@ -324,7 +324,12 @@ def main():
|
||||
ids1 = ids1.flatten().tolist()
|
||||
ids2 = ids2.flatten().tolist()
|
||||
|
||||
|
||||
# Neu: merken, welche Kamera welchen Marker gesehen hat
|
||||
seen_by = {} # id -> 1, 2 oder 3 (3 = beide)
|
||||
for mid in ids1:
|
||||
seen_by[mid] = seen_by.get(mid, 0) | 1
|
||||
for mid in ids2:
|
||||
seen_by[mid] = seen_by.get(mid, 0) | 2
|
||||
|
||||
# Build dicts: id -> corners, center, rvec/tvec (per-camera PnP)
|
||||
def build_marker_dict(img, corners_list, ids, K, D, draw = False) -> Tuple[Dict[int,np.ndarray], Dict[int,np.ndarray], Dict[int,Tuple[np.ndarray,np.ndarray]]]:
|
||||
@@ -411,7 +416,7 @@ def main():
|
||||
# Collect markers seen by at least one camera
|
||||
all_ids = set(ids1) | set(ids2)
|
||||
# Output structures
|
||||
rows = [("id", "x_mm", "y_mm", "z_mm", "roll_deg", "pitch_deg", "yaw_deg")]
|
||||
rows = [("id", "x_mm", "y_mm", "z_mm", "roll_deg", "pitch_deg", "yaw_deg", "seen_by")]
|
||||
marker_list = []
|
||||
|
||||
# Camera orientations in Euler (ZYX)
|
||||
@@ -473,7 +478,7 @@ def main():
|
||||
continue
|
||||
roll, pitch, yaw = orientation_in_machine(mid)
|
||||
x_mm, y_mm, z_mm = (X_mach * 1000.0).tolist()
|
||||
rows.append((mid, f"{x_mm:.2f}", f"{y_mm:.2f}", f"{z_mm:.2f}", f"{roll:.3f}", f"{pitch:.3f}", f"{yaw:.3f}"))
|
||||
rows.append((mid, f"{x_mm:.2f}", f"{y_mm:.2f}", f"{z_mm:.2f}", f"{roll:.3f}", f"{pitch:.3f}", f"{yaw:.3f}", seen_by.get(mid, 0)))
|
||||
marker_list.append({
|
||||
"id": int(mid),
|
||||
"position_mm": [float(x_mm), float(y_mm), float(z_mm)],
|
||||
|
||||
Reference in New Issue
Block a user