Spaces:
Build error
Build error
edits
Browse files
app.py
CHANGED
|
@@ -196,7 +196,6 @@ def generate_matching_superfeatures(im1, im2, Imagenet_model=False, scale_id=6,
|
|
| 196 |
if j == 0: col_ = col.colors[9]
|
| 197 |
col_ = 255*np.array(colors.to_rgba(col_))[:3]
|
| 198 |
img1rsz[m,n, :] = col_[::-1]
|
| 199 |
-
fin_img.append(img1rsz)
|
| 200 |
|
| 201 |
img2rsz = np.copy(im2_cv)
|
| 202 |
print('im2:', im2.size)
|
|
@@ -214,7 +213,6 @@ def generate_matching_superfeatures(im1, im2, Imagenet_model=False, scale_id=6,
|
|
| 214 |
# if j == 0: col_ = col.colors[9]
|
| 215 |
col_ = 255*np.array(colors.to_rgba(col_))[:3]
|
| 216 |
img2rsz[m,n, :] = col_[::-1]
|
| 217 |
-
fin_img.append(img2rsz)
|
| 218 |
|
| 219 |
fig1 = plt.figure(1)
|
| 220 |
plt.imshow(cv2.cvtColor(img1rsz, cv2.COLOR_BGR2RGB))
|
|
@@ -231,29 +229,13 @@ def generate_matching_superfeatures(im1, im2, Imagenet_model=False, scale_id=6,
|
|
| 231 |
ax2.axis('off')
|
| 232 |
plt.tight_layout()
|
| 233 |
# fig2.canvas.draw()
|
| 234 |
-
|
| 235 |
-
# fig = plt.figure()
|
| 236 |
-
# grid = ImageGrid(fig, 111, nrows_ncols=(2, 1), axes_pad=0.1)
|
| 237 |
-
# for ax, img in zip(grid, fin_img):
|
| 238 |
-
# ax.imshow(cv2.cvtColor(img, cv2.COLOR_BGR2RGB))
|
| 239 |
-
# ax.axis('scaled')
|
| 240 |
-
# ax.axis('off')
|
| 241 |
-
# plt.tight_layout()
|
| 242 |
-
# fig.suptitle("Matching SFs", fontsize=16)
|
| 243 |
-
|
| 244 |
-
# fig.canvas.draw()
|
| 245 |
-
# # Now we can save it to a numpy array.
|
| 246 |
-
# data = np.frombuffer(fig.canvas.tostring_rgb(), dtype=np.uint8)
|
| 247 |
-
# data = data.reshape(fig.canvas.get_width_height()[::-1] + (3,))
|
| 248 |
-
|
| 249 |
-
|
| 250 |
|
| 251 |
f = lambda m,c: plt.plot([],[],marker=m, color=c, ls="none")[0]
|
| 252 |
handles = [f("s", col.colors[i]) for i in range(n_sf_ids)]
|
| 253 |
fig_leg = plt.figure(3)
|
| 254 |
legend = plt.legend(handles, sf_idx_, framealpha=1, frameon=False, facecolor='w',fontsize=15, loc="center")
|
| 255 |
# fig_leg = legend.figure
|
| 256 |
-
fig_leg.canvas.draw()
|
| 257 |
ax3 = plt.gca()
|
| 258 |
# ax2.axis('scaled')
|
| 259 |
ax3.axis('off')
|
|
|
|
| 196 |
if j == 0: col_ = col.colors[9]
|
| 197 |
col_ = 255*np.array(colors.to_rgba(col_))[:3]
|
| 198 |
img1rsz[m,n, :] = col_[::-1]
|
|
|
|
| 199 |
|
| 200 |
img2rsz = np.copy(im2_cv)
|
| 201 |
print('im2:', im2.size)
|
|
|
|
| 213 |
# if j == 0: col_ = col.colors[9]
|
| 214 |
col_ = 255*np.array(colors.to_rgba(col_))[:3]
|
| 215 |
img2rsz[m,n, :] = col_[::-1]
|
|
|
|
| 216 |
|
| 217 |
fig1 = plt.figure(1)
|
| 218 |
plt.imshow(cv2.cvtColor(img1rsz, cv2.COLOR_BGR2RGB))
|
|
|
|
| 229 |
ax2.axis('off')
|
| 230 |
plt.tight_layout()
|
| 231 |
# fig2.canvas.draw()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 232 |
|
| 233 |
f = lambda m,c: plt.plot([],[],marker=m, color=c, ls="none")[0]
|
| 234 |
handles = [f("s", col.colors[i]) for i in range(n_sf_ids)]
|
| 235 |
fig_leg = plt.figure(3)
|
| 236 |
legend = plt.legend(handles, sf_idx_, framealpha=1, frameon=False, facecolor='w',fontsize=15, loc="center")
|
| 237 |
# fig_leg = legend.figure
|
| 238 |
+
# fig_leg.canvas.draw()
|
| 239 |
ax3 = plt.gca()
|
| 240 |
# ax2.axis('scaled')
|
| 241 |
ax3.axis('off')
|