feng-x commited on
Commit
4529e19
·
verified ·
1 Parent(s): 8bc7d2f

Upload folder using huggingface_hub

Browse files
Files changed (2) hide show
  1. measure_finger.py +6 -0
  2. src/debug_observer.py +6 -1
measure_finger.py CHANGED
@@ -697,6 +697,12 @@ def measure_finger(
697
  width_data = sobel_measurement["width_data"]
698
  width_data["median_width_cm"] = sobel_measurement["median_width_cm"]
699
 
 
 
 
 
 
 
700
  debug_image = draw_comprehensive_edge_overlay(
701
  full_image=image_canonical,
702
  edge_data=edge_data,
 
697
  width_data = sobel_measurement["width_data"]
698
  width_data["median_width_cm"] = sobel_measurement["median_width_cm"]
699
 
700
+ # Apply calibration to overlay display
701
+ raw_cm = width_data["median_width_cm"]
702
+ cal_cm = apply_calibration(raw_cm)
703
+ width_data["median_width_cm"] = cal_cm
704
+ width_data["raw_width_cm"] = raw_cm
705
+
706
  debug_image = draw_comprehensive_edge_overlay(
707
  full_image=image_canonical,
708
  edge_data=edge_data,
src/debug_observer.py CHANGED
@@ -1188,6 +1188,7 @@ def draw_comprehensive_edge_overlay(
1188
 
1189
  # 5. Add text annotations in top-left corner with adaptive sizing
1190
  median_cm = width_data["median_width_cm"]
 
1191
  median_px = width_data["median_width_px"]
1192
  std_px = width_data["std_width_px"]
1193
  num_samples = width_data["num_samples"]
@@ -1198,9 +1199,13 @@ def draw_comprehensive_edge_overlay(
1198
  line_height = int(35 + h / 70.0) # Scale line spacing (increased for better readability)
1199
  thickness = max(1, int(h / 500.0))
1200
 
 
 
 
 
1201
  annotations = [
1202
  f"Sobel Edge Detection Results:",
1203
- f" Median Width: {median_cm:.3f} cm ({median_px:.1f} px)",
1204
  f" Std Dev: {std_px:.2f} px",
1205
  f" Valid Edges: {np.sum(valid_rows)}/{len(valid_rows)} ({valid_pct:.1f}%)",
1206
  f" Measurements: {num_samples}",
 
1188
 
1189
  # 5. Add text annotations in top-left corner with adaptive sizing
1190
  median_cm = width_data["median_width_cm"]
1191
+ raw_cm = width_data.get("raw_width_cm")
1192
  median_px = width_data["median_width_px"]
1193
  std_px = width_data["std_width_px"]
1194
  num_samples = width_data["num_samples"]
 
1199
  line_height = int(35 + h / 70.0) # Scale line spacing (increased for better readability)
1200
  thickness = max(1, int(h / 500.0))
1201
 
1202
+ width_label = f" Width: {median_cm:.3f} cm"
1203
+ if raw_cm is not None:
1204
+ width_label += f" (raw {raw_cm:.3f})"
1205
+
1206
  annotations = [
1207
  f"Sobel Edge Detection Results:",
1208
+ width_label,
1209
  f" Std Dev: {std_px:.2f} px",
1210
  f" Valid Edges: {np.sum(valid_rows)}/{len(valid_rows)} ({valid_pct:.1f}%)",
1211
  f" Measurements: {num_samples}",