stevenbucaille
commited on
Update README.md
Browse files
README.md
CHANGED
@@ -81,7 +81,7 @@ import torch
|
|
81 |
from PIL import Image
|
82 |
import requests
|
83 |
|
84 |
-
url = "https://github.com/magicleap/SuperGluePretrainedNetwork/blob/master/assets/phototourism_sample_images/
|
85 |
im1 = Image.open(requests.get(url, stream=True).raw)
|
86 |
url = "https://github.com/magicleap/SuperGluePretrainedNetwork/blob/master/assets/phototourism_sample_images/london_bridge_19481797_2295892421.jpg?raw=true"
|
87 |
im2 = Image.open(requests.get(url, stream=True).raw)
|
@@ -103,9 +103,9 @@ import torch
|
|
103 |
from PIL import Image
|
104 |
import requests
|
105 |
|
106 |
-
url_image_1 = "https://github.com/
|
107 |
image_1 = Image.open(requests.get(url_image_1, stream=True).raw)
|
108 |
-
url_image_2 = "https://github.com/
|
109 |
image_2 = Image.open(requests.get(url_image_2, stream=True).raw)
|
110 |
|
111 |
images = [image_1, image_2]
|
@@ -156,14 +156,19 @@ image1_indices = torch.nonzero(image1_mask).squeeze()
|
|
156 |
image1_keypoints = outputs.keypoints[0, 1][image0_matches]
|
157 |
|
158 |
# Draw matches
|
159 |
-
for
|
160 |
-
keypoint0_x, keypoint0_y = int(keypoint0[0]
|
161 |
-
keypoint1_x, keypoint1_y = int(keypoint1[0]
|
162 |
-
color =
|
163 |
-
|
164 |
-
|
|
|
|
|
|
|
165 |
```
|
166 |
|
|
|
|
|
167 |
|
168 |
## Training Details
|
169 |
|
|
|
81 |
from PIL import Image
|
82 |
import requests
|
83 |
|
84 |
+
url = "https://github.com/magicleap/SuperGluePretrainedNetwork/blob/master/assets/phototourism_sample_images/london_bridge_19481797_2295892421.jpg?raw=true"
|
85 |
im1 = Image.open(requests.get(url, stream=True).raw)
|
86 |
url = "https://github.com/magicleap/SuperGluePretrainedNetwork/blob/master/assets/phototourism_sample_images/london_bridge_19481797_2295892421.jpg?raw=true"
|
87 |
im2 = Image.open(requests.get(url, stream=True).raw)
|
|
|
103 |
from PIL import Image
|
104 |
import requests
|
105 |
|
106 |
+
url_image_1 = "https://github.com/magicleap/SuperGluePretrainedNetwork/blob/master/assets/phototourism_sample_images/london_bridge_19481797_2295892421.jpg?raw=true"
|
107 |
image_1 = Image.open(requests.get(url_image_1, stream=True).raw)
|
108 |
+
url_image_2 = "https://github.com/magicleap/SuperGluePretrainedNetwork/blob/master/assets/phototourism_sample_images/london_bridge_19481797_2295892421.jpg?raw=true"
|
109 |
image_2 = Image.open(requests.get(url_image_2, stream=True).raw)
|
110 |
|
111 |
images = [image_1, image_2]
|
|
|
156 |
image1_keypoints = outputs.keypoints[0, 1][image0_matches]
|
157 |
|
158 |
# Draw matches
|
159 |
+
for keypoint0, keypoint1, score in zip(image0_keypoints, image1_keypoints, image0_matching_scores):
|
160 |
+
keypoint0_x, keypoint0_y = int(keypoint0[0]), int(keypoint0[1])
|
161 |
+
keypoint1_x, keypoint1_y = int(keypoint1[0] + width), int(keypoint1[1])
|
162 |
+
color = [0, 1, 0, 0.5] # Set color based on score
|
163 |
+
plt.plot([keypoint0_x, keypoint1_x], [keypoint0_y, keypoint1_y], color=color, linewidth=1)
|
164 |
+
|
165 |
+
# Save the image
|
166 |
+
plt.savefig("matched_image.png", dpi=300, bbox_inches='tight')
|
167 |
+
plt.close()
|
168 |
```
|
169 |
|
170 |
+
![image/png](https://cdn-uploads.huggingface.co/production/uploads/632885ba1558dac67c440aa8/PiLL7svnN2dTqOxrsobJb.png)
|
171 |
+
|
172 |
|
173 |
## Training Details
|
174 |
|