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


Python cv2.WINDOW_KEEPRATIO屬性代碼示例

本文整理匯總了Python中cv2.WINDOW_KEEPRATIO屬性的典型用法代碼示例。如果您正苦於以下問題:Python cv2.WINDOW_KEEPRATIO屬性的具體用法?Python cv2.WINDOW_KEEPRATIO怎麽用?Python cv2.WINDOW_KEEPRATIO使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在cv2的用法示例。


在下文中一共展示了cv2.WINDOW_KEEPRATIO屬性的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: prepare

# 需要導入模塊: import cv2 [as 別名]
# 或者: from cv2 import WINDOW_KEEPRATIO [as 別名]
def prepare(self):
    if self.save_folder and not os.path.exists(self.save_folder):
      try:
        os.makedirs(self.save_folder)
      except OSError:
        assert os.path.exists(self.save_folder),\
            "Error creating "+self.save_folder
    self.cam = Camera.classes[self.camera]()
    self.cam.open(**self.cam_kwargs)
    config = DISConfig(self.cam)
    config.main()
    self.bbox = config.box
    t,img0 = self.cam.get_image()
    self.correl = DIS(img0,bbox=self.bbox)
    if self.show_image:
      try:
        flags = cv2.WINDOW_NORMAL | cv2.WINDOW_KEEPRATIO
      except AttributeError:
        flags = cv2.WINDOW_NORMAL
      cv2.namedWindow("DISCorrel",flags)
    self.loops = 0
    self.last_fps_print = 0
    self.last_fps_loops = 0 
開發者ID:LaboratoireMecaniqueLille,項目名稱:crappy,代碼行數:25,代碼來源:discorrel.py

示例2: prepare

# 需要導入模塊: import cv2 [as 別名]
# 或者: from cv2 import WINDOW_KEEPRATIO [as 別名]
def prepare(self):
    if self.save_folder and not os.path.exists(self.save_folder):
      try:
        os.makedirs(self.save_folder)
      except OSError:
        assert os.path.exists(self.save_folder),\
            "Error creating "+self.save_folder
    self.cam = Camera.classes[self.camera]()
    self.cam.open(**self.cam_kwargs)
    self.ve = VE(**self.ve_kwargs)
    config = VE_config(self.cam,self.ve)
    config.main()
    self.ve.start_tracking()
    if self.show_image:
      try:
        flags = cv2.WINDOW_NORMAL | cv2.WINDOW_KEEPRATIO
      except AttributeError:
        flags = cv2.WINDOW_NORMAL
      cv2.namedWindow("Videoextenso",flags)
    self.loops = 0
    self.last_fps_print = 0
    self.last_fps_loops = 0 
開發者ID:LaboratoireMecaniqueLille,項目名稱:crappy,代碼行數:24,代碼來源:videoExtenso.py

示例3: cv2_show_image

# 需要導入模塊: import cv2 [as 別名]
# 或者: from cv2 import WINDOW_KEEPRATIO [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

示例4: begin_cv

# 需要導入模塊: import cv2 [as 別名]
# 或者: from cv2 import WINDOW_KEEPRATIO [as 別名]
def begin_cv(self):
    try:
      flags = cv2.WINDOW_NORMAL | cv2.WINDOW_KEEPRATIO
    # WINDOW_KEEPRATIO is not implemented in all opencv versions...
    except AttributeError:
      flags = cv2.WINDOW_NORMAL
    cv2.namedWindow(self.title, flags) 
開發者ID:LaboratoireMecaniqueLille,項目名稱:crappy,代碼行數:9,代碼來源:displayer.py

示例5: cv2_imshow

# 需要導入模塊: import cv2 [as 別名]
# 或者: from cv2 import WINDOW_KEEPRATIO [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


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