saim1309 commited on
Commit
21e587f
·
verified ·
1 Parent(s): e0400ee

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -3
app.py CHANGED
@@ -31,11 +31,21 @@ def run_pipeline(flat_img, pers_img, mockup_json, xml_gt):
31
  json_pts = get_json_corners(mockup_json)
32
  gt_pts = extract_points_from_xml(xml_gt)
33
  pred_pts = extract_points_from_xml(xml_pred_path)
34
-
35
- match_json_gt = draw_feature_matching(img_json.copy(), json_pts, img_xml.copy(), gt_pts, draw_boxes=True)
36
- match_json_pred = draw_feature_matching(img_json.copy(), json_pts, img_xml.copy(), pred_pts, draw_boxes=True)
 
37
 
38
  stacked = stack_images_side_by_side(match_json_gt, match_json_pred)
 
 
 
 
 
 
 
 
 
39
 
40
  # Save result
41
  cv2.imwrite(result_path, cv2.cvtColor(stacked, cv2.COLOR_RGB2BGR))
 
31
  json_pts = get_json_corners(mockup_json)
32
  gt_pts = extract_points_from_xml(xml_gt)
33
  pred_pts = extract_points_from_xml(xml_pred_path)
34
+ color = (0, 255, 0) # Green for boxes
35
+ color2 = (0, 0, 255) # Blue for lines
36
+ match_json_gt = draw_feature_matching(img_json.copy(), json_pts, img_xml.copy(), gt_pts, color,draw_boxes=True)
37
+ match_json_pred = draw_feature_matching(img_json.copy(), json_pts, img_xml.copy(), pred_pts, color2,draw_boxes=True)
38
 
39
  stacked = stack_images_side_by_side(match_json_gt, match_json_pred)
40
+ # Add vertical center line
41
+ h, w, _ = stacked.shape
42
+ center_x = w // 2
43
+ cv2.line(stacked, (center_x, 0), (center_x, h), (255, 0, 0), 4) # blue line
44
+
45
+ # Add text labels
46
+ font = cv2.FONT_HERSHEY_SIMPLEX
47
+ cv2.putText(stacked, "Ground Truth", (50, 50), font, 2, (0, 255, 0), 3, cv2.LINE_AA)
48
+ cv2.putText(stacked, "Our Result", (center_x + 50, 50), font, 2, (0, 0, 255), 3, cv2.LINE_AA)
49
 
50
  # Save result
51
  cv2.imwrite(result_path, cv2.cvtColor(stacked, cv2.COLOR_RGB2BGR))