我剪下一个动物的图像,对齐它,修改它,然后我想把它粘贴回原始图像。因此,工作流程如下所示:
我有检测和校准动物的代码:
# get rotation matrix
M = cv2.getRotationMatrix2D(eyesCenter, angle, scale)
# update the translation component of the matrix
tX = w * 0.5
tY = h * LeftEye[1]
M[0, 2] += (tX - eyesCenter[0])
M[1, 2] += (tY - eyesCenter[1])
# apply the affine transformation
output = cv2.warpAffine(image, M, (w, h), flags=cv2.INTER_CUBIC)
我试着用
Mp = np.linalg.inv(M)
但我得到了一个错误:
Last 2 dimensions of the array must be square
如何将猫头鹰放回原始图像
添加第三行[0,0,1]。这会使乘积
y = A x
成为一个二维齐次向量(即一个包含三个分量的向量),其前两个分量与未添加行时相同相关问题 更多 >
编程相关推荐