Ayesha352 commited on
Commit
06ffef5
·
verified ·
1 Parent(s): 211990b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -3
app.py CHANGED
@@ -47,7 +47,9 @@ def parse_xml_points(xml_file):
47
  def homography_all_detectors(flat_file, persp_file, json_file, xml_file):
48
  flat_img = cv2.imread(flat_file)
49
  persp_img = cv2.imread(persp_file)
50
- mockup = json.load(open(json_file.name))
 
 
51
  roi_data = mockup["printAreas"][0]["position"]
52
  roi_x, roi_y = roi_data["x"], roi_data["y"]
53
  roi_w, roi_h = mockup["printAreas"][0]["width"], mockup["printAreas"][0]["height"]
@@ -55,7 +57,9 @@ def homography_all_detectors(flat_file, persp_file, json_file, xml_file):
55
 
56
  flat_gray = preprocess_gray_clahe(flat_img)
57
  persp_gray = preprocess_gray_clahe(persp_img)
58
- xml_points = parse_xml_points(xml_file.name)
 
 
59
 
60
  methods = ["SIFT","ORB","BRISK","KAZE","AKAZE"]
61
  gallery_files = []
@@ -118,4 +122,4 @@ iface = gr.Interface(
118
  description="Shows 4 views per detector. Original resolution kept; click on Gallery images to open full."
119
  )
120
 
121
- iface.launch()
 
47
  def homography_all_detectors(flat_file, persp_file, json_file, xml_file):
48
  flat_img = cv2.imread(flat_file)
49
  persp_img = cv2.imread(persp_file)
50
+
51
+ # FIX: Use the file paths directly instead of .name
52
+ mockup = json.load(open(json_file))
53
  roi_data = mockup["printAreas"][0]["position"]
54
  roi_x, roi_y = roi_data["x"], roi_data["y"]
55
  roi_w, roi_h = mockup["printAreas"][0]["width"], mockup["printAreas"][0]["height"]
 
57
 
58
  flat_gray = preprocess_gray_clahe(flat_img)
59
  persp_gray = preprocess_gray_clahe(persp_img)
60
+
61
+ # FIX: Use the file path directly instead of .name
62
+ xml_points = parse_xml_points(xml_file)
63
 
64
  methods = ["SIFT","ORB","BRISK","KAZE","AKAZE"]
65
  gallery_files = []
 
122
  description="Shows 4 views per detector. Original resolution kept; click on Gallery images to open full."
123
  )
124
 
125
+ iface.launch()