本文整理匯總了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)))