如何解决将cv2.warpPerspective的结果写入现有数组
我正在尝试将warpTransform()
的结果写入现有数组中,但是我不知道如何执行此操作。我正在尝试将多个ROI放入单个图像中,类似于image attached。
如果使用新创建的数组,则会得到结果,然后可以将其添加到另一个数组(vstack,hstack等)中。
for i in range(whatever):
source_segment[i] = np.array([all_points[1][0],all_points[0][2],all_points[0][3],all_points[3][0]],np.float32)
dest_segment[i] = np.array([[0,0],[(step),maxHeight],[0,maxHeight]],np.float32)
src = source_segment[i]
dst = dest_segment[i]
m = cv2.getPerspectiveTransform(src,dst)
warped = cv2.warpPerspective(image,m,(int(step),maxHeight))
warpedd = np.hstack((warped,warpedd))
但是我需要将结果直接写到预先存在的数组中:
warped = np.zeros([1900,2500,3],np.float32)
我的问题是通过指向现有数组dst
中的四个点来正确定义warped
。
像dst = warped[[x1,y1],[x2,y2],[x3,y3],[x4,y4]]
或dst = [warped[x1][y1],warped[x2][y2],warped[x3][y3],warped[x4][y4]]
如何正确定义大数组warped
中的一种子数组,以便cv2.warpPerspective
直接在其中写入?
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。