當前位置: 首頁>>代碼示例>>Python>>正文


Python cv2.convertMaps方法代碼示例

本文整理匯總了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 
開發者ID:RobinBruegger,項目名稱:PartiallyReversibleUnet,代碼行數:17,代碼來源:utils.py

示例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))) 
開發者ID:baumgach,項目名稱:PHiSeg-code,代碼行數:12,代碼來源:utils.py


注:本文中的cv2.convertMaps方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。