Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/ruby-on-rails-4/2.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
有人能用OpenCV中使用cvRemap的代码解释cvRemap吗?_Opencv - Fatal编程技术网

有人能用OpenCV中使用cvRemap的代码解释cvRemap吗?

有人能用OpenCV中使用cvRemap的代码解释cvRemap吗?,opencv,Opencv,OpenCV用户知道cvRemap用于进行几何变换。 mapx和mapy参数是提供映射的数据结构 目标图像中的信息。 我可以创建两个整数数组,其中包含从1到1024或从1到768的随机值吗 如果我处理图像(1024x768) 然后用这些值指定mapx和mapy? 然后在cvRemap()中使用它们? 它会完成这项工作吗?或者使用mapx和mapy的唯一方法是使用函数cvunistortmap()获取其赋值? 我想知道,因为我想扭曲图像。 以防万一,我也已经签出了学习OpenCV的书。我使用cvR

OpenCV用户知道cvRemap用于进行几何变换。 mapx和mapy参数是提供映射的数据结构 目标图像中的信息。 我可以创建两个整数数组,其中包含从1到1024或从1到768的随机值吗 如果我处理图像(1024x768) 然后用这些值指定mapx和mapy? 然后在cvRemap()中使用它们? 它会完成这项工作吗?或者使用mapx和mapy的唯一方法是使用函数cvunistortmap()获取其赋值? 我想知道,因为我想扭曲图像。
以防万一,我也已经签出了学习OpenCV的书。

我使用cvRemap应用失真校正。 贴图x部分以图像分辨率显示,并为每个像素存储要应用的x偏移,而贴图y部分与y偏移相同

在不失真的情况下

# create map_x/map_y
self.map_x = cvCreateImage(cvGetSize(self.image), IPL_DEPTH_32F, 1)
self.map_y = cvCreateImage(cvGetSize(self.image), IPL_DEPTH_32F, 1)
# I know the camera intrisic already so create a distortion map out
# of it for each image pixel
# this defined where each pixel has to go so the image is no longer
# distorded
cvInitUndistortMap(self.intrinsic, self.distortion, self.map_x, self.map_y)
# later in the code:
# "image_raw" is the distorted image, i want to store the undistorted into
# "self.image"
cvRemap(image_raw, self.image, self.map_x, self.map_y)
因此:map_x/map_y是浮点值,具有图像分辨率,就像1024x768中的两个图像一样。cvRemap中发生的事情基本上类似于

orig_pixel = input_image[x,y]
new_x = map_x[x,y]
new_y = map_y[x,y]
output_image[new_x,new_y] = orig_pixel

你想用它做什么样的几何变换?

我使用cvRemap应用失真校正。 贴图x部分以图像分辨率显示,并为每个像素存储要应用的x偏移,而贴图y部分与y偏移相同

在不失真的情况下

# create map_x/map_y
self.map_x = cvCreateImage(cvGetSize(self.image), IPL_DEPTH_32F, 1)
self.map_y = cvCreateImage(cvGetSize(self.image), IPL_DEPTH_32F, 1)
# I know the camera intrisic already so create a distortion map out
# of it for each image pixel
# this defined where each pixel has to go so the image is no longer
# distorded
cvInitUndistortMap(self.intrinsic, self.distortion, self.map_x, self.map_y)
# later in the code:
# "image_raw" is the distorted image, i want to store the undistorted into
# "self.image"
cvRemap(image_raw, self.image, self.map_x, self.map_y)
因此:map_x/map_y是浮点值,具有图像分辨率,就像1024x768中的两个图像一样。cvRemap中发生的事情基本上类似于

orig_pixel = input_image[x,y]
new_x = map_x[x,y]
new_y = map_y[x,y]
output_image[new_x,new_y] = orig_pixel
你想用它做什么样的几何变换