Spaces:
Build error
Build error
temp
Browse files
app.py
CHANGED
@@ -115,22 +115,35 @@ def generate_matching_superfeatures(im1, im2, scale_id=6, threshold=50):
|
|
115 |
col_ = 255*np.array(colors.to_rgba(col_))[:3]
|
116 |
img2rsz[m,n, :] = col_[::-1]
|
117 |
fin_img.append(img2rsz)
|
118 |
-
|
119 |
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
plt.tight_layout()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
127 |
# fig.suptitle("Matching SFs", fontsize=16)
|
128 |
|
129 |
# fig.canvas.draw()
|
130 |
# # Now we can save it to a numpy array.
|
131 |
# data = np.frombuffer(fig.canvas.tostring_rgb(), dtype=np.uint8)
|
132 |
# data = data.reshape(fig.canvas.get_width_height()[::-1] + (3,))
|
133 |
-
return
|
134 |
|
135 |
|
136 |
# GRADIO APP
|
@@ -153,7 +166,7 @@ iface = gr.Interface(
|
|
153 |
gr.inputs.Image(shape=(1024, 1024), type="pil"),
|
154 |
gr.inputs.Slider(minimum=1, maximum=7, step=1, default=3, label="Scale"),
|
155 |
gr.inputs.Slider(minimum=1, maximum=255, step=25, default=100, label="Binarization Threshold")],
|
156 |
-
outputs="plot",
|
157 |
# outputs=gr.outputs.Image(shape=(1024,2048), type="plot"),
|
158 |
title=title,
|
159 |
layout="horizontal",
|
|
|
115 |
col_ = 255*np.array(colors.to_rgba(col_))[:3]
|
116 |
img2rsz[m,n, :] = col_[::-1]
|
117 |
fin_img.append(img2rsz)
|
|
|
118 |
|
119 |
+
fig1 = plt.figure()
|
120 |
+
fig1.imshow(cv2.cvtColor(img1rsz, cv2.COLOR_BGR2RGB))
|
121 |
+
ax1 = plt.gca()
|
122 |
+
ax1.axis('scaled')
|
123 |
+
ax1.axis('off')
|
124 |
+
|
125 |
+
plt.tight_layout()
|
126 |
+
|
127 |
+
fig2 = plt.figure()
|
128 |
+
fig2.imshow(cv2.cvtColor(img2rsz, cv2.COLOR_BGR2RGB))
|
129 |
+
ax2 = plt.gca()
|
130 |
+
ax2.axis('scaled')
|
131 |
+
ax2.axis('off')
|
132 |
+
|
133 |
+
# fig = plt.figure()
|
134 |
+
# grid = ImageGrid(fig, 111, nrows_ncols=(2, 1), axes_pad=0.1)
|
135 |
+
# for ax, img in zip(grid, fin_img):
|
136 |
+
# ax.imshow(cv2.cvtColor(img, cv2.COLOR_BGR2RGB))
|
137 |
+
# ax.axis('scaled')
|
138 |
+
# ax.axis('off')
|
139 |
+
# plt.tight_layout()
|
140 |
# fig.suptitle("Matching SFs", fontsize=16)
|
141 |
|
142 |
# fig.canvas.draw()
|
143 |
# # Now we can save it to a numpy array.
|
144 |
# data = np.frombuffer(fig.canvas.tostring_rgb(), dtype=np.uint8)
|
145 |
# data = data.reshape(fig.canvas.get_width_height()[::-1] + (3,))
|
146 |
+
return fig1,fig2
|
147 |
|
148 |
|
149 |
# GRADIO APP
|
|
|
166 |
gr.inputs.Image(shape=(1024, 1024), type="pil"),
|
167 |
gr.inputs.Slider(minimum=1, maximum=7, step=1, default=3, label="Scale"),
|
168 |
gr.inputs.Slider(minimum=1, maximum=255, step=25, default=100, label="Binarization Threshold")],
|
169 |
+
outputs=["plot", "plot"],
|
170 |
# outputs=gr.outputs.Image(shape=(1024,2048), type="plot"),
|
171 |
title=title,
|
172 |
layout="horizontal",
|