YannisK commited on
Commit
ce1e3e0
·
1 Parent(s): f981819
Files changed (1) hide show
  1. app.py +7 -2
app.py CHANGED
@@ -115,14 +115,19 @@ def generate_matching_superfeatures(im1, im2, scale_id=6, threshold=50):
115
  fin_img.append(img2rsz)
116
 
117
 
118
- fig = plt.figure(figsize=(12,25))
119
  grid = ImageGrid(fig, 111, nrows_ncols=(2, 1), axes_pad=0.1)
120
  for ax, img in zip(grid, fin_img):
121
  ax.imshow(cv2.cvtColor(img, cv2.COLOR_BGR2RGB))
122
  ax.axis('scaled')
123
  ax.axis('off')
124
  plt.tight_layout()
125
- fig.suptitle("Matching SFs", fontsize=16)
 
 
 
 
 
126
  return fig
127
 
128
 
 
115
  fin_img.append(img2rsz)
116
 
117
 
118
+ fig = plt.figure()
119
  grid = ImageGrid(fig, 111, nrows_ncols=(2, 1), axes_pad=0.1)
120
  for ax, img in zip(grid, fin_img):
121
  ax.imshow(cv2.cvtColor(img, cv2.COLOR_BGR2RGB))
122
  ax.axis('scaled')
123
  ax.axis('off')
124
  plt.tight_layout()
125
+ # fig.suptitle("Matching SFs", fontsize=16)
126
+
127
+ fig.canvas.draw()
128
+ # Now we can save it to a numpy array.
129
+ data = np.frombuffer(fig.canvas.tostring_rgb(), dtype=np.uint8)
130
+ data = data.reshape(fig.canvas.get_width_height()[::-1] + (3,))
131
  return fig
132
 
133