当前位置: 首页>>代码示例>>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;未经允许,请勿转载。