Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/293.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 查找cv2.remap前后单个点的对应像素坐标_Python_Opencv_Computer Vision - Fatal编程技术网

Python 查找cv2.remap前后单个点的对应像素坐标

Python 查找cv2.remap前后单个点的对应像素坐标,python,opencv,computer-vision,Python,Opencv,Computer Vision,让我们首先说,我有一个静态图像,称为leftFrame 此帧被传递到方法cv2.remap(leftFrame,map1,map2,cv2.INTER_-LANCZ0S4,0),以便将原始图像(leftFrame)中的每个像素重新分配到新位置。假设map1和map2是从cv2.initUndistortionRectiveyMap(MLS、dLS、RL、PL、imgShape、cv2.CV_16SC2)输出的,之前已经计算过MLS、dLS、RL、PL 事情做得很好, 但是,现在我只想得到新帧中单

让我们首先说,我有一个静态图像,称为
leftFrame

此帧被传递到方法
cv2.remap(leftFrame,map1,map2,cv2.INTER_-LANCZ0S4,0)
,以便将原始图像(
leftFrame
)中的每个像素重新分配到新位置。假设map1和map2是从
cv2.initUndistortionRectiveyMap(MLS、dLS、RL、PL、imgShape、cv2.CV_16SC2)输出的
,之前已经计算过MLS、dLS、RL、PL

事情做得很好,

但是,现在我只想得到新帧中单个点的对应像素坐标,给定该点在初始原始帧(leftFrame)中的原始像素坐标

我怎样才能做到呢

代码简化如下:

Left_Stereo_Map = cv2.initUndistortRectifyMap(MLS, dLS, RL, PL,imgShape,cv2.CV_16SC2)
leftCap = cv2.VideoCapture(PORT)
 while (True):
   # Collect image continously
   ret1, leftFrame = leftCap.read()
   Left_nice = cv2.remap(leftFrame, Left_Stereo_Map[0], Left_Stereo_Map[1], cv2.INTER_LANCZOS4, cv2.BORDER_CONSTANT, 0)
   original_x = PREDEFINED_X
   original_y = PREDEFINED_Y
   x_after = ?
   y_after = ?

   cv2.waitkey(1)



感谢大家花时间阅读这个问题。祝你在这个时候平安

最简单的解决方案是以相反的方向分别调用initUnderstrateRectiveyMap。返回的map1/2包含您需要的映射,分别用于x和y坐标。

您查看了吗?