Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to draw the matches just like done in the paper? #13

Open
chuanzhidong opened this issue Jun 17, 2019 · 3 comments
Open

how to draw the matches just like done in the paper? #13

chuanzhidong opened this issue Jun 17, 2019 · 3 comments

Comments

@chuanzhidong
Copy link

how to draw the matches just like done in the paper?

@AlphonsG
Copy link

AlphonsG commented Jan 9, 2020

Hello, did you ever receive an answer?

@AlphonsG
Copy link

AlphonsG commented Jan 11, 2020

how to draw the matches just like done in the paper?

I think I figured it out. Insert the code below in the demo.py file after this line: X, Y, Z = reg.register(IX, IY) (Don't forget to import numpy as np).
matches = [[i, i] for i in range(0, len(X))]
matches = np.asarray(matches)
_, ax = plt.subplots()
plot_matches(
ax,
IX,
IY,
X,
Y,
matches,
matches_color='b')
ax.axis('off')
plt.show()

@wisemaker @studentguoyiyuan @sunbin1205

@RutenburgIG
Copy link

RutenburgIG commented Feb 20, 2020

...
X, Y, Z, d1 = self.register(IX, IY)
registered = tps_warp(Y, Z, IY, IX.shape)

res = np.zeros(shape=(IX.shape[0] * 2, IX.shape[1], 3), dtype=np.uint8)
res[:IX.shape[0], :, :] = IX
res[IX.shape[0]:, :, :] = registered

for i, pnt in enumerate(X):
	src_x = int(pnt[1])
	src_y = int(pnt[0])
	dst_x = int(Z[i][1])
	dst_y = int(Z[i][0] + IX.shape[0])

	cv2.line(res, (src_x, src_y), (dst_x, dst_y), (255, 0, 0), 2)
	cv2.circle(res, (src_x, src_y), 5, (0, 255, 0), -1)
	cv2.circle(res, (dst_x, dst_y), 5, (0, 255, 0), -1)

cv2.imwrite('res.jpg', res) 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants