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


Python cv2.WINDOW_GUI_NORMAL属性代码示例

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


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

示例1: cv2_show_image

# 需要导入模块: import cv2 [as 别名]
# 或者: from cv2 import WINDOW_GUI_NORMAL [as 别名]
def cv2_show_image(window_name, image,
                   size_wh=None, location_xy=None):
    """Helper function for specifying window size and location when
    displaying images with cv2.

    Args:
        window_name: str window name
        image: ndarray image to display
        size_wh: window size (w, h)
        location_xy: window location (x, y)
    """

    if size_wh is not None:
        cv2.namedWindow(window_name,
                        cv2.WINDOW_KEEPRATIO | cv2.WINDOW_GUI_NORMAL)
        cv2.resizeWindow(window_name, *size_wh)
    else:
        cv2.namedWindow(window_name, cv2.WINDOW_AUTOSIZE)

    if location_xy is not None:
        cv2.moveWindow(window_name, *location_xy)

    cv2.imshow(window_name, image) 
开发者ID:kujason,项目名称:ip_basic,代码行数:25,代码来源:vis_utils.py

示例2: cv2_imshow

# 需要导入模块: import cv2 [as 别名]
# 或者: from cv2 import WINDOW_GUI_NORMAL [as 别名]
def cv2_imshow(window_name, image,
               size_wh=None, row_col=None, location_xy=None):
    """Helper function for specifying window size and location when
        displaying images with cv2

    Args:
        window_name (string): Window title
        image: image to display
        size_wh: resize window
            Recommended sizes for 1920x1080 screen:
                2 col: (930, 280)
                3 col: (620, 187)
                4 col: (465, 140)
        row_col: Row and column to show images like subplots
        location_xy: location of window
    """

    if size_wh is not None:
        cv2.namedWindow(window_name, cv2.WINDOW_KEEPRATIO | cv2.WINDOW_GUI_NORMAL)
        cv2.resizeWindow(window_name, *size_wh)
    else:
        cv2.namedWindow(window_name, cv2.WINDOW_AUTOSIZE | cv2.WINDOW_GUI_NORMAL)

    if row_col is not None:
        start_x_offset = 60
        start_y_offset = 25
        y_offset = 28

        subplot_row = row_col[0]
        subplot_col = row_col[1]
        location_xy = (start_x_offset + subplot_col * size_wh[0],
                       start_y_offset + subplot_row * size_wh[1] + subplot_row * y_offset)

    if location_xy is not None:
        cv2.moveWindow(window_name, *location_xy)

    cv2.imshow(window_name, image) 
开发者ID:kujason,项目名称:monopsr,代码行数:39,代码来源:vis_utils.py

示例3: main

# 需要导入模块: import cv2 [as 别名]
# 或者: from cv2 import WINDOW_GUI_NORMAL [as 别名]
def main():
    args = parse_args()
    update_config(cfg, args)

    # cudnn related setting
    cudnn.benchmark = cfg.CUDNN.BENCHMARK
    torch.backends.cudnn.deterministic = cfg.CUDNN.DETERMINISTIC
    torch.backends.cudnn.enabled = cfg.CUDNN.ENABLED


    ########## 加载human detecotor model
    from lib.detector.yolo.human_detector import load_model as yolo_model
    human_model = yolo_model()

    from lib.detector.yolo.human_detector import human_bbox_get as yolo_det
    bboxs, scores = yolo_det(args.img_input, human_model, confidence=0.5) # bboxes (N, 4) [x0, y0, x1, y1]

    # bbox is coordinate location
    inputs, origin_img, center, scale = PreProcess(args.img_input, bboxs, scores, cfg)

    # load MODEL
    model = model_load(cfg)

    with torch.no_grad():
        # compute output heatmap
        #  inputs = inputs[:,[2,1,0]]
        #  inputs = cv2.cvtColor(inputs, cv2.COLOR_BGR2RGB)
        output = model(inputs)
        # compute coordinate
        preds, maxvals = get_final_preds(
            cfg, output.clone().cpu().numpy(), np.asarray(center), np.asarray(scale))

    image = plot_keypoint(origin_img, preds, maxvals, 0.3)
    cv2.imwrite(args.img_output, image)
    if args.display:
        cv2.namedWindow("enhanced", cv2.WINDOW_GUI_NORMAL);
        cv2.resizeWindow("enhanced", 960, 480);
        cv2.imshow('enhanced', image)
        cv2.waitKey(5000) 
开发者ID:lxy5513,项目名称:hrnet,代码行数:41,代码来源:demo.py

示例4: main

# 需要导入模块: import cv2 [as 别名]
# 或者: from cv2 import WINDOW_GUI_NORMAL [as 别名]
def main():
    args = parse_args()
    update_config(cfg, args)

    # cudnn related setting
    cudnn.benchmark = cfg.CUDNN.BENCHMARK
    torch.backends.cudnn.deterministic = cfg.CUDNN.DETERMINISTIC
    torch.backends.cudnn.enabled = cfg.CUDNN.ENABLED

    ########## 加载human detecotor model
    from lib.detector.mmdetection.high_api import load_model
    human_model = load_model()
    from lib.detector.mmdetection.high_api import human_boxes_get as mmd_detector
    bboxs, scores = mmd_detector(human_model, args.img_input) # bboxes (N, 4) [x0, y0, x1, y1]
    # bbox is coordinate location
    inputs, origin_img, center, scale = PreProcess(args.img_input, bboxs, scores, cfg)

    # load HRNET MODEL
    model = model_load(cfg)
    with torch.no_grad():
        # compute output heatmap
        #  inputs = inputs[:,[2,1,0]]
        #  inputs = cv2.cvtColor(inputs, cv2.COLOR_BGR2RGB)
        output = model(inputs)
        # compute coordinate
        preds, maxvals = get_final_preds(
            cfg, output.clone().cpu().numpy(), np.asarray(center), np.asarray(scale))

    image = plot_keypoint(origin_img, preds, maxvals, 0.3)
    cv2.imwrite(args.img_output, image)
    if args.display:
        cv2.namedWindow("enhanced", cv2.WINDOW_GUI_NORMAL);
        cv2.resizeWindow("enhanced", 960, 480);
        cv2.imshow('enhanced', image)
        cv2.waitKey(5000) 
开发者ID:lxy5513,项目名称:hrnet,代码行数:37,代码来源:demo_mmd.py


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