将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 (将#修改为@)