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


Python cv2.moveWindow方法代碼示例

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


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

示例1: display_multiple

# 需要導入模塊: import cv2 [as 別名]
# 或者: from cv2 import moveWindow [as 別名]
def display_multiple(images: List[Tuple[List, Optional[str]]]):
    """Displays one or more captures in a CV2 window. Useful for debugging

    Args:
        images: List of tuples containing MxNx3 pixel arrays and optional titles OR
            list of image data
    """
    for image in images:
        if isinstance(image, tuple):
            image_data = image[0]
        else:
            image_data = image

        if isinstance(image, tuple) and len(image) > 1:
            title = image[1]
        else:
            title = "Camera Output"

        cv2.namedWindow(title)
        cv2.moveWindow(title, 500, 500)
        cv2.imshow(title, image_data)
    cv2.waitKey(0)
    cv2.destroyAllWindows() 
開發者ID:BYU-PCCL,項目名稱:holodeck,代碼行數:25,代碼來源:captures.py

示例2: preview

# 需要導入模塊: import cv2 [as 別名]
# 或者: from cv2 import moveWindow [as 別名]
def preview(self):
        """ Blocking function. Opens OpenCV window to display stream. """
        self.connect()
        win_name = 'RTSP'
        cv2.namedWindow(win_name, cv2.WINDOW_AUTOSIZE)
        cv2.moveWindow(win_name, 20, 20)

        while True:
            cv2.imshow(win_name, self.get_frame())
            # if self._latest is not None:
            #    cv2.imshow(win_name,self._latest)
            if cv2.waitKey(25) & 0xFF == ord('q'):
                break
        cv2.waitKey()
        cv2.destroyAllWindows()
        cv2.waitKey() 
開發者ID:Benehiko,項目名稱:ReolinkCameraAPI,代碼行數:18,代碼來源:RtspClient.py

示例3: show

# 需要導入模塊: import cv2 [as 別名]
# 或者: from cv2 import moveWindow [as 別名]
def show(self):
        lenw = len(self.windows)
        w_l = int(self.screen_size[0] / lenw)

        max_num_line = math.ceil(math.sqrt(lenw))  # 取平方根
        # TODO 權重

        for i, name in enumerate(self.windows):
            # if (i+1) >max_num_line:
            #     #TODO 換行
            #     cv2.moveWindow(name, w_l * i, h_x*j)
            #     pass

            win = self.windows[name]
            image = win.image
            # image = self.windows[name]
            # h_x = int(image.shape[1] / w_l * image.shape[0]) #保持比例
            h_x = int(w_l / win.lenght_y * win.hight_x)  # 保持比例
            # print((w_l,h_x))
            img2 = cv2.resize(image, (w_l, h_x))
            cv2.moveWindow(name, w_l * i, 0)
            cv2.imshow(name, img2) 
開發者ID:makelove,項目名稱:OpenCV-Python-Tutorial,代碼行數:24,代碼來源:opencv_windows_management.py

示例4: cv2_show_image

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

示例5: show_img_cb

# 需要導入模塊: import cv2 [as 別名]
# 或者: from cv2 import moveWindow [as 別名]
def show_img_cb(self,event):
    	try: 


		cv2.namedWindow("RGB_Image", cv2.WINDOW_NORMAL)
		cv2.moveWindow("RGB_Image", 25, 75)
		
		cv2.namedWindow("Processed_Image", cv2.WINDOW_NORMAL)
		cv2.moveWindow("Processed_Image", 500, 75)

        	# And one for the depth image
		cv2.moveWindow("Depth_Image", 950, 75)
		cv2.namedWindow("Depth_Image", cv2.WINDOW_NORMAL)


        	cv2.imshow("RGB_Image",self.frame)
        	cv2.imshow("Processed_Image",self.display_image)
        	cv2.imshow("Depth_Image",self.depth_display_image)
      		cv2.waitKey(3)
    	except:
		pass 
開發者ID:PacktPublishing,項目名稱:Learning-Robotics-using-Python-Second-Edition,代碼行數:23,代碼來源:cv_bridge_demo.py

示例6: videoize

# 需要導入模塊: import cv2 [as 別名]
# 或者: from cv2 import moveWindow [as 別名]
def videoize(func, args, src = 0, win_name = "Cam", delim_wait = 1, delim_key = 27):
    cap = cv2.VideoCapture(src)
    while(1):
        ret, frame = cap.read()
        # To speed up processing; Almost real-time on my PC
        frame = cv2.resize(frame, dsize=None, fx=0.5, fy=0.5)
        frame = cv2.flip(frame, 1)
        out = func(frame, args)
        if out is None:
            continue
        out = cv2.resize(out, dsize=None, fx=1.4, fy=1.4)
        cv2.imshow(win_name, out)
        cv2.moveWindow(win_name, (s_w - out.shape[1])/2, (s_h - out.shape[0])/2)
        k = cv2.waitKey(delim_wait)

        if k == delim_key:
            cv2.destroyAllWindows()
            cap.release()
            return 
開發者ID:Aravind-Suresh,項目名稱:FaceSwap,代碼行數:21,代碼來源:main.py

示例7: show_pic

# 需要導入模塊: import cv2 [as 別名]
# 或者: from cv2 import moveWindow [as 別名]
def show_pic(img, bboxes=None, name='pic'):
    '''
    輸入:
        img:圖像array
        bboxes:圖像的所有boudning box list, 格式為[[x_min, y_min, x_max, y_max]....]
        names:每個box對應的名稱
    '''
    show_img = img.copy()
    if not isinstance(bboxes, np.ndarray):
        bboxes = np.array(bboxes)
    for point in bboxes.astype(np.int):
        cv2.line(show_img, tuple(point[0]), tuple(point[1]), (255, 0, 0), 2)
        cv2.line(show_img, tuple(point[1]), tuple(point[2]), (255, 0, 0), 2)
        cv2.line(show_img, tuple(point[2]), tuple(point[3]), (255, 0, 0), 2)
        cv2.line(show_img, tuple(point[3]), tuple(point[0]), (255, 0, 0), 2)
    # cv2.namedWindow(name, 0)  # 1表示原圖
    # cv2.moveWindow(name, 0, 0)
    # cv2.resizeWindow(name, 1200, 800)  # 可視化的圖片大小
    cv2.imshow(name, show_img)


# 圖像均為cv2讀取 
開發者ID:SURFZJY,項目名稱:Real-time-Text-Detection,代碼行數:24,代碼來源:augment.py

示例8: _show_modulate

# 需要導入模塊: import cv2 [as 別名]
# 或者: from cv2 import moveWindow [as 別名]
def _show_modulate(im, score_viz):
        """
        show the current activations on top of the current crop
        """
        if score_viz is None: return # modulation is not active

        im = cv2.resize(im, (MEDIATE_SIZE, MEDIATE_SIZE)).astype(np.uint8)
        canvas = np.zeros([im.shape[0], im.shape[1], 3], dtype=np.uint8)

        # calculate the color map
        score_im_base = cv2.resize(score_viz[0], im.shape[:2])
        score_im_base = (255*score_im_base).astype(np.uint8)
        im_color = cv2.applyColorMap(score_im_base, cv2.COLORMAP_JET)

        # show the image
        overlayed_im = cv2.addWeighted(im, 0.8, im_color, 0.7, 0)
        canvas[:, :im.shape[1], :] = overlayed_im
        cv2.imshow('modulated', canvas)
        cv2.moveWindow('modulated', 1200, 800) 
開發者ID:xl-sr,項目名稱:THOR,代碼行數:21,代碼來源:wrapper.py

示例9: renderToScreenSetup

# 需要導入模塊: import cv2 [as 別名]
# 或者: from cv2 import moveWindow [as 別名]
def renderToScreenSetup(self):
        cv2.namedWindow('RGB cam')
        cv2.namedWindow('Depth cam')
        #if MAKE_VIDEO:
        #    cv2.moveWindow('RGB cam', -1 , self.showsz + LINUX_OFFSET['y_delta'])
        #    cv2.moveWindow('Depth cam', self.showsz + LINUX_OFFSET['x_delta'] + LINUX_OFFSET['y_delta'], -1)
        cv2.namedWindow('RGB prefilled')
        cv2.namedWindow('Semantics')
        cv2.namedWindow('Surface Normal')
        #    cv2.moveWindow('Surface Normal', self.showsz + self.showsz + LINUX_OFFSET['x_delta'] + LINUX_OFFSET['y_delta'], -1)
        #    cv2.moveWindow('RGB prefilled', self.showsz + LINUX_OFFSET['x_delta'] + LINUX_OFFSET['y_delta'], self.showsz + LINUX_OFFSET['y_delta'])
        #    cv2.moveWindow('Semantics', self.showsz + self.showsz + LINUX_OFFSET['x_delta'] + LINUX_OFFSET['y_delta'], self.showsz + LINUX_OFFSET['y_delta'])
        #elif HIGH_RES_MONITOR:
        #    cv2.moveWindow('RGB cam', -1 , self.showsz + LINUX_OFFSET['y_delta'])
        #    cv2.moveWindow('Depth cam', self.showsz + LINUX_OFFSET['x_delta'] + LINUX_OFFSET['y_delta'], self.showsz + LINUX_OFFSET['y_delta'])
        #
        #if LIVE_DEMO:
        #    cv2.moveWindow('RGB cam', -1 , 768)
        #    cv2.moveWindow('Depth cam', 512, 768) 
開發者ID:alexsax,項目名稱:midlevel-reps,代碼行數:21,代碼來源:pcrender.py

示例10: plot_boxes

# 需要導入模塊: import cv2 [as 別名]
# 或者: from cv2 import moveWindow [as 別名]
def plot_boxes(image, boxes, IDs, im_name=None):
    for i in range(len(boxes)):
        box = boxes[i]
        ID = IDs[i]
        bpt0, bpt1 = (int(box[0]), int(box[1])), (int(box[2]), int(box[3]))
        cv2.rectangle(image, bpt0, bpt1, colors[i], 3)
        cv2.putText(image, str(ID), bpt0, fontFace=font, fontScale=fontScale, color=colors[i], thickness=5)

    if not im_name:
        winname = 'image'
    else:
        winname = im_name
    cv2.namedWindow(winname)        # Create a named window
    cv2.moveWindow(winname, 1000,800)  # Move it to (40,30)
    cv2.imshow(winname, image)
    cv2.waitKey(950)
    if im_name:
        cv2.imwrite('test_imgs/' + im_name, image)
    #  cv2.destroyAllWindows() 
開發者ID:lxy5513,項目名稱:hrnet,代碼行數:21,代碼來源:utilitys.py

示例11: preview_stream

# 需要導入模塊: import cv2 [as 別名]
# 或者: from cv2 import moveWindow [as 別名]
def preview_stream(stream):
    """ Display stream in an OpenCV window until "q" key is pressed """
    # together with waitkeys later, helps to close the video window effectively
    _cv2.startWindowThread()
    
    for frame in stream.frame_generator():
        if frame is not None:
            _cv2.imshow('Video', frame)
            _cv2.moveWindow('Video',5,5)
        else:
            break
        key = _cv2.waitKey(1) & 0xFF
        if key == ord("q"):
            break
    _cv2.waitKey(1)
    _cv2.destroyAllWindows()
    _cv2.waitKey(1) 
開發者ID:statueofmike,項目名稱:rtsp,代碼行數:19,代碼來源:preview.py

示例12: updateImage

# 需要導入模塊: import cv2 [as 別名]
# 或者: from cv2 import moveWindow [as 別名]
def updateImage(self, img, text, pause_time, banner_text=""):
        """ Update the image on the screen. 
        
        Arguments:
            img: [2D ndarray] Image to show on the screen as a numpy array.
            text: [str] Text that will be printed on the image.
        """

        img = drawText(img, text)

        if not banner_text:
            banner_text = "LiveViewer"

        # Update the image on the screen
        cv2.imshow(banner_text, img)

        # If this is the first image, move it to the upper left corner
        if self.first_image:
            
            cv2.moveWindow(banner_text, 0, 0)

            self.first_image = False


        cv2.waitKey(int(1000*pause_time)) 
開發者ID:CroatianMeteorNetwork,項目名稱:RMS,代碼行數:27,代碼來源:LiveViewer.py

示例13: imshow

# 需要導入模塊: import cv2 [as 別名]
# 或者: from cv2 import moveWindow [as 別名]
def imshow(winname, img, block = True, position = None, maximized = False, rgb = False):
    if isinstance(img, str):
        img = imread(path = img)
    
    cv2.namedWindow(winname, cv2.WINDOW_NORMAL)
    if rgb:
        img = rgb2bgr(img)
    cv2.imshow(winname, img)
    if position is not None:
#         cv2.moveWindow(winname, position[0], position[1])
        move_win(winname, position)
    
    if maximized:
        maximize_win(winname)  
        
        
    if block:
#         cv2.waitKey(0)
        event.wait_key(" ")
        cv2.destroyAllWindows() 
開發者ID:HLIG,項目名稱:HUAWEIOCR-2019,代碼行數:22,代碼來源:img.py

示例14: preImgOps

# 需要導入模塊: import cv2 [as 別名]
# 或者: from cv2 import moveWindow [as 別名]
def preImgOps(self, imgName):
        """
        圖像的預處理操作
        :param imgName: 圖像的而明朝
        :return: 灰度化和resize之後的圖片對象
        """
        strPath = self.strDir + imgName

        img = cv2.imread(strPath)  # 讀取圖片
        cv2.moveWindow("", 1000, 100)
        # cv2.imshow("原始圖", img)
        # 預處理操作
        reImg = cv2.resize(img, (800, 900), interpolation=cv2.INTER_CUBIC)  #
        img2gray = cv2.cvtColor(reImg, cv2.COLOR_BGR2GRAY)  # 將圖片壓縮為單通道的灰度圖
        return img2gray, reImg 
開發者ID:Leezhen2014,項目名稱:python--,代碼行數:17,代碼來源:BlurDetection.py

示例15: normalize_icon_image

# 需要導入模塊: import cv2 [as 別名]
# 或者: from cv2 import moveWindow [as 別名]
def normalize_icon_image(self, img):
        h, w = img.shape[0:2]

        laplacian_threshold = 60
        img_laplacian = cv2.Laplacian(img, cv2.CV_64F)
        img_laplacian_abs = cv2.convertScaleAbs(img_laplacian)
        img_laplacian_gray = \
            cv2.cvtColor(img_laplacian_abs, cv2.COLOR_BGR2GRAY)
        ret, img_laplacian_mask = \
            cv2.threshold(img_laplacian_gray, laplacian_threshold, 255, 0)
        out_img = self.down_sample_2d(img_laplacian_mask, 12, 12)

        if False:
            cv2.imshow('orig', cv2.resize(img, (160, 160)))
            cv2.imshow('laplacian_abs', cv2.resize(
                img_laplacian_abs, (160, 160)))
            cv2.imshow('laplacian_gray', cv2.resize(
                img_laplacian_gray, (160, 160)))
            cv2.imshow('out', cv2.resize(out_img, (160, 160)))
            cv2.moveWindow('orig', 80, 20)
            cv2.moveWindow('laplacian_abs', 80, 220)
            cv2.moveWindow('laplacian_gray', 80, 420)
            cv2.moveWindow('out', 80, 820)
            ch = 0xFF & cv2.waitKey(1)
            if ch == ord('q'):
                sys.exit()
        return [
            out_img,
            img,
            img,  # ununsed
        ]

    # Define feature extraction algorithm. 
開發者ID:hasegaw,項目名稱:IkaLog,代碼行數:35,代碼來源:icon.py


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