当我决定从头开始编码以更好地理解其管道时,我正在对 OpenCV 函数cv2.warpPerspective进行一些实验。尽管我(希望)遵循了每一个理论步骤,但似乎我仍然遗漏了一些东西,并且我正在努力理解什么。请你帮助我好吗?
cv2.warpPerspective 的输出与真实 DST 重叠
# Invert the homography SRC->DST to DST->SRC
hinv = np.linalg.inv(h)
src = gray1
dst = np.zeros(gray2.shape)
h, w = src.shape
# Remap back and check the domain
for ox in range(h):
for oy in range(w):
# Backproject from DST to SRC
xw, yw, w = hinv.dot(np.array([ox, oy, 1]).T)
# cv2.INTER_NEAREST
x, y = int(xw/w), int(yw/w)
# Check if it falls in the src domain
c1 = …Run Code Online (Sandbox Code Playgroud)