本文整理汇总了Python中cv2.convertMaps方法的典型用法代码示例。如果您正苦于以下问题:Python cv2.convertMaps方法的具体用法?Python cv2.convertMaps怎么用?Python cv2.convertMaps使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cv2
的用法示例。
在下文中一共展示了cv2.convertMaps方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: dense_image_warp
# 需要导入模块: import cv2 [as 别名]
# 或者: from cv2 import convertMaps [as 别名]
def dense_image_warp(im, dx, dy, interp=cv2.INTER_LINEAR):
map_x, map_y = deformation_to_transformation(dx, dy)
do_optimization = (interp == cv2.INTER_LINEAR)
# The following command converts the maps to compact fixed point representation
# this leads to a ~20% increase in speed but could lead to accuracy losses
# Can be uncommented
if do_optimization:
map_x, map_y = cv2.convertMaps(map_x, map_y, dstmap1type=cv2.CV_16SC2)
remapped = cv2.remap(im, map_x, map_y, interpolation=interp, borderMode=cv2.BORDER_REFLECT) #borderValue=float(np.min(im)))
if im.ndim > remapped.ndim:
remapped = np.expand_dims(remapped, im.ndim)
return remapped
示例2: dense_image_warp
# 需要导入模块: import cv2 [as 别名]
# 或者: from cv2 import convertMaps [as 别名]
def dense_image_warp(im, dx, dy, interp=cv2.INTER_LINEAR, do_optimisation=True):
map_x, map_y = deformation_to_transformation(dx, dy)
# The following command converts the maps to compact fixed point representation
# this leads to a ~20% increase in speed but could lead to accuracy losses
# Can be uncommented
if do_optimisation:
map_x, map_y = cv2.convertMaps(map_x, map_y, dstmap1type=cv2.CV_16SC2)
return cv2.remap(im, map_x, map_y, interpolation=interp, borderMode=cv2.BORDER_REFLECT) #borderValue=float(np.min(im)))