omar87 commited on
Commit
bc47ec3
·
1 Parent(s): 90d7188

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -0
app.py CHANGED
@@ -15,6 +15,11 @@ def calculate_similarity(img1, img2):
15
  def image_similarity(img1, img2):
16
  img1 = img1.astype(np.uint8)
17
  img2 = img2.astype(np.uint8)
 
 
 
 
 
18
  similarity_score = calculate_similarity(img1, img2)
19
  result = f"Similarity Score: {similarity_score:.4f}"
20
  return result
 
15
  def image_similarity(img1, img2):
16
  img1 = img1.astype(np.uint8)
17
  img2 = img2.astype(np.uint8)
18
+ if img1.shape != img2.shape:
19
+ max_height = max(img1.shape[0], img2.shape[0])
20
+ max_width = max(img1.shape[1], img2.shape[1])
21
+ img1 = cv2.resize(img1, (max_width, max_height))
22
+ img2 = cv2.resize(img2, (max_width, max_height))
23
  similarity_score = calculate_similarity(img1, img2)
24
  result = f"Similarity Score: {similarity_score:.4f}"
25
  return result