当前位置: 首页>>代码示例>>Python>>正文


Python cv2.ROTATE_90_CLOCKWISE属性代码示例

本文整理汇总了Python中cv2.ROTATE_90_CLOCKWISE属性的典型用法代码示例。如果您正苦于以下问题:Python cv2.ROTATE_90_CLOCKWISE属性的具体用法?Python cv2.ROTATE_90_CLOCKWISE怎么用?Python cv2.ROTATE_90_CLOCKWISE使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在cv2的用法示例。


在下文中一共展示了cv2.ROTATE_90_CLOCKWISE属性的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: ff_mask_batch

# 需要导入模块: import cv2 [as 别名]
# 或者: from cv2 import ROTATE_90_CLOCKWISE [as 别名]
def ff_mask_batch(size, b_size, maxLen, maxWid, maxAng, maxNum, maxVer, minLen = 20, minWid = 15, minVer = 5):

    mask = None
    temp = ff_mask(size, 1, maxLen, maxWid, maxAng, maxNum, maxVer, minLen=minLen, minWid=minWid, minVer=minVer)
    temp = temp[0]
    for ib in range(b_size):
        if ib == 0:
            mask = np.expand_dims(temp, 0)
        else:
            mask = np.concatenate((mask, np.expand_dims(temp, 0)), 0)

        temp = cv2.rotate(temp, cv2.ROTATE_90_CLOCKWISE)
        if ib == 3:
            temp = cv2.flip(temp, 0)

    return mask 
开发者ID:Forty-lock,项目名称:PEPSI-Fast_image_inpainting_with_parallel_decoding_network,代码行数:18,代码来源:ops.py

示例2: check_video_rotation

# 需要导入模块: import cv2 [as 别名]
# 或者: from cv2 import ROTATE_90_CLOCKWISE [as 别名]
def check_video_rotation(filename):
    # thanks to
    # https://stackoverflow.com/questions/53097092/frame-from-video-is-upside-down-after-extracting/55747773#55747773

    # this returns meta-data of the video file in form of a dictionary
    meta_dict = ffmpeg.probe(filename)

    # from the dictionary, meta_dict['streams'][0]['tags']['rotate'] is the key
    # we are looking for
    rotation_code = None
    try:
        if int(meta_dict['streams'][0]['tags']['rotate']) == 90:
            rotation_code = cv2.ROTATE_90_CLOCKWISE
        elif int(meta_dict['streams'][0]['tags']['rotate']) == 180:
            rotation_code = cv2.ROTATE_180
        elif int(meta_dict['streams'][0]['tags']['rotate']) == 270:
            rotation_code = cv2.ROTATE_90_COUNTERCLOCKWISE
        else:
            raise ValueError
    except KeyError:
        pass

    return rotation_code 
开发者ID:stefanopini,项目名称:simple-HRNet,代码行数:25,代码来源:visualization.py

示例3: fix_orientation

# 需要导入模块: import cv2 [as 别名]
# 或者: from cv2 import ROTATE_90_CLOCKWISE [as 别名]
def fix_orientation(image, orientation):
    # 1 = Horizontal(normal)
    # 2 = Mirror horizontal
    # 3 = Rotate 180
    # 4 = Mirror vertical
    # 5 = Mirror horizontal and rotate 270 CW
    # 6 = Rotate 90 CW
    # 7 = Mirror horizontal and rotate 90 CW
    # 8 = Rotate 270 CW

    if type(orientation) is list:
        orientation = orientation[0]

    if orientation == 1:
        pass
    elif orientation == 2:
        image = cv2.flip(image, 0)
    elif orientation == 3:
        image = cv2.rotate(image, cv2.ROTATE_180)
    elif orientation == 4:
        image = cv2.flip(image, 1)
    elif orientation == 5:
        image = cv2.flip(image, 0)
        image = cv2.rotate(image, cv2.ROTATE_90_COUNTERCLOCKWISE)
    elif orientation == 6:
        image = cv2.rotate(image, cv2.ROTATE_90_CLOCKWISE)
    elif orientation == 7:
        image = cv2.flip(image, 0)
        image = cv2.rotate(image, cv2.ROTATE_90_CLOCKWISE)
    elif orientation == 8:
        image = cv2.rotate(image, cv2.ROTATE_90_COUNTERCLOCKWISE)

    return image 
开发者ID:AbdoKamel,项目名称:simple-camera-pipeline,代码行数:35,代码来源:pipeline_utils.py


注:本文中的cv2.ROTATE_90_CLOCKWISE属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。