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


Python cv2.startWindowThread方法代码示例

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


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

示例1: pick_corrs

# 需要导入模块: import cv2 [as 别名]
# 或者: from cv2 import startWindowThread [as 别名]
def pick_corrs(images, n_pts_to_pick=4):
    data = [ [[], 0, False, False, False, image, "Image %d" % i, n_pts_to_pick]
            for i, image in enumerate(images)]

    for d in data:
        win_name = d[6]
        cv2.namedWindow(win_name)
        cv2.setMouseCallback(win_name, corr_picker_callback, d)
        cv2.startWindowThread()
        cv2.imshow(win_name, d[5])

    key = None
    while key != '\n' and key != '\r' and key != 'q':
        key = cv2.waitKey(33)
        key = chr(key & 255) if key >= 0 else None

    cv2.destroyAllWindows()

    if key == 'q':
        return None
    else:
        return [d[0] for d in data] 
开发者ID:nelpy,项目名称:nelpy,代码行数:24,代码来源:homography.py

示例2: dump_2dcoor

# 需要导入模块: import cv2 [as 别名]
# 或者: from cv2 import startWindowThread [as 别名]
def dump_2dcoor():
    camera = libcpm.Camera()
    camera.setup()
    runner = get_parallel_runner('../data/cpm.npy')
    cv2.namedWindow('color')
    cv2.startWindowThread()
    cnt = 0
    while True:
        cnt += 1
        m1 = camera.get_for_py(0)
        m1 = np.array(m1, copy=False)
        m2 = camera.get_for_py(1)
        m2 = np.array(m2, copy=False)

        o1, o2 = runner(m1, m2)
        pts = []
        for k in range(14):
            pts.append((argmax_2d(o1[:,:,k]),
                argmax_2d(o2[:,:,k])))
        pts = np.asarray(pts)
        np.save('pts{}.npy'.format(cnt), pts)
        cv2.imwrite("frame{}.png".format(cnt), m1);
        if cnt == 10:
            break 
开发者ID:ppwwyyxx,项目名称:Stereo-Pose-Machines,代码行数:26,代码来源:main.py

示例3: main

# 需要导入模块: import cv2 [as 别名]
# 或者: from cv2 import startWindowThread [as 别名]
def main():
    '''
    Arguments to be set:
        showCam : determine if show the camera preview screen.
    '''
    print("Enter main() function")
    
    if args.testImage is not None:
        img = cv2.imread(args.testImage)
        img = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
        img = cv2.resize(img, FACE_SHAPE)
        print(class_label[result[0]])
        sys.exit(0)

    showCam = 1

    capture = getCameraStreaming()

    if showCam:
        cv2.startWindowThread()
        cv2.namedWindow(windowsName, cv2.WND_PROP_FULLSCREEN)
        cv2.setWindowProperty(windowsName, cv2.WND_PROP_FULLSCREEN, cv2.WND_PROP_FULLSCREEN)
    
    showScreenAndDectect(capture) 
开发者ID:a514514772,项目名称:Real-Time-Facial-Expression-Recognition-with-DeepLearning,代码行数:26,代码来源:webcam_detection.py

示例4: run

# 需要导入模块: import cv2 [as 别名]
# 或者: from cv2 import startWindowThread [as 别名]
def run(self):
        cv2.startWindowThread()
        while True:
            img = numpy.zeros((480, 640, 3))
            skeleton = kinect.tracked_skeleton
            if skeleton:
                for user, skel in skeleton.items():
                    for joint_name in skel.joints:
                        x, y = getattr(skel, joint_name).pixel_coordinate
                        pt = (int(x), int(y))
                        cv2.circle(img, pt, 5, (255, 255, 255), thickness=-1)
                kinect.remove_all_users()
            cv2.imshow('Skeleton', img)
            cv2.waitKey(50)

        self.sub_skel.close()
        self.context.term() 
开发者ID:poppy-project,项目名称:pypot,代码行数:19,代码来源:sensor.py

示例5: __init__

# 需要导入模块: import cv2 [as 别名]
# 或者: from cv2 import startWindowThread [as 别名]
def __init__(self, rom_name, vis,frameskip=1,windowname='preview'):
    self.ale = ALEInterface()
    self.max_frames_per_episode = self.ale.getInt("max_num_frames_per_episode");
    self.ale.setInt("random_seed",123)
    self.ale.setInt("frame_skip",frameskip)
    romfile = str(ROM_PATH)+str(rom_name)
    if not os.path.exists(romfile):
      print('No ROM file found at "'+romfile+'".\nAdjust ROM_PATH or double-check the filt exists.')
    self.ale.loadROM(romfile)
    self.legal_actions = self.ale.getMinimalActionSet()
    self.action_map = dict()
    self.windowname = windowname
    for i in range(len(self.legal_actions)):
      self.action_map[self.legal_actions[i]] = i

    # print(self.legal_actions)
    self.screen_width,self.screen_height = self.ale.getScreenDims()
    print("width/height: " +str(self.screen_width) + "/" + str(self.screen_height))
    self.vis = vis
    if vis:
      cv2.startWindowThread()
      cv2.namedWindow(self.windowname, flags=cv2.WINDOW_AUTOSIZE) # permit manual resizing 
开发者ID:rdadolf,项目名称:fathom,代码行数:24,代码来源:emulator.py

示例6: preview_stream

# 需要导入模块: import cv2 [as 别名]
# 或者: from cv2 import startWindowThread [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

示例7: __init__

# 需要导入模块: import cv2 [as 别名]
# 或者: from cv2 import startWindowThread [as 别名]
def __init__(self, src, window_name=None, org=None):
        self.src = src
        self.window_name = window_name if window_name else src

        cv2.startWindowThread()
        cv2.namedWindow(self.window_name, cv2.WINDOW_AUTOSIZE)
        if org:
            # Set the window position
            x, y = org
            cv2.moveWindow(self.window_name, x, y)

        super().__init__() 
开发者ID:jagin,项目名称:detectron2-pipeline,代码行数:14,代码来源:display_video.py

示例8: resizeImage

# 需要导入模块: import cv2 [as 别名]
# 或者: from cv2 import startWindowThread [as 别名]
def resizeImage(file_path): 
    #Resize Cropping & Padding an image to the 640x480 pixel size
    if file_path is not -1:
        if check_image_with_pil(file_path):
            image = Image.open(file_path)
            image.thumbnail(size, Image.ANTIALIAS)
            image_size = image.size

            padding_0 = max( (size[0] - image_size[0]) / 2, 0 )
            padding_1 = max( (size[1] - image_size[1]) / 2, 0 )
            cv2.namedWindow('Original Image')
            cv2.namedWindow('Resized Image')
            cv2.startWindowThread()
            orig_img = cv2.imread(file_path, 0)
            cv2.imshow('Original Image',orig_img)
            cv2.waitKey(2)

            if((padding_0==0) & (padding_1==0)):
                image.save(file_path, img_save_type)
            else:
                thumb = image.crop( (0, 0, size[0], size[1]) )
                thumb = ImageChops.offset(thumb, int(padding_0), int(padding_1))
                thumb.save(file_path)

            resized_img = cv2.imread(file_path, 0)
            cv2.imshow('Resized Image',resized_img)
    else :
        cv2.destroyAllWindows()
        cv2.waitKey(2) 
开发者ID:DrewNF,项目名称:Tensorflow_Object_Tracking_Video,代码行数:31,代码来源:Utils_Image.py

示例9: stereo_cpm_viewer

# 需要导入模块: import cv2 [as 别名]
# 或者: from cv2 import startWindowThread [as 别名]
def stereo_cpm_viewer():
    camera = libcpm.Camera()
    camera.setup()
    runner = get_parallel_runner('../data/cpm.npy')
    cv2.namedWindow('color')
    cv2.startWindowThread()
    cnt = 0
    while True:
        cnt += 1
        m1 = camera.get_for_py(0)
        m1 = np.array(m1, copy=False)
        m2 = camera.get_for_py(1)
        m2 = np.array(m2, copy=False)

        m1s = cv2.resize(m1, (368,368))
        m2s = cv2.resize(m2, (368,368))

        o1, o2 = runner(m1s, m2s)

        #buf = dumps([m1, m2, o1, o2])
        #f = open('recording/{:03d}.npy'.format(cnt), 'w')
        #f.write(buf)
        #f.close()

        c1 = colorize(m1, o1[:,:,:-1].sum(axis=2))
        c2 = colorize(m2, o2[:,:,:-1].sum(axis=2))
        viz = np.concatenate((c1, c2), axis=1)
        cv2.imshow('color', viz / 255.0) 
开发者ID:ppwwyyxx,项目名称:Stereo-Pose-Machines,代码行数:30,代码来源:main.py

示例10: main

# 需要导入模块: import cv2 [as 别名]
# 或者: from cv2 import startWindowThread [as 别名]
def main():
    '''
    Arguments to be set:
        showCam : determine if show the camera preview screen.
    '''
    print("Enter main() function")
    
    capture = getCameraStreaming()

    cv2.startWindowThread()
    cv2.namedWindow(windowsName, cv2.WND_PROP_FULLSCREEN)
    cv2.setWindowProperty(windowsName, cv2.WND_PROP_FULLSCREEN, cv2.WND_PROP_FULLSCREEN)
    
    while True:
        recContent = speechRecognition()
        if recContent is not None:
            emotion = showScreenAndDectect(capture)
            if emotion == "Angry":
                emoji = " >:O"
            elif emotion == "Fear":
                emoji = " :-S"
            elif emotion == "Happy":
                emoji = " :-D"
            elif emotion == "Sad":
                emoji = " :'("
            elif emotion == "Surprise":
                emoji = " :-O"
            else:
                emoji = " "
            print("Output result: " + recContent + emoji) 
开发者ID:a514514772,项目名称:Real-Time-Facial-Expression-Recognition-with-DeepLearning,代码行数:32,代码来源:gen_sentence_with_emoticons.py

示例11: test_ssd

# 需要导入模块: import cv2 [as 别名]
# 或者: from cv2 import startWindowThread [as 别名]
def test_ssd():
    face_detector = FaceDetectorSSDMobilenetV2()
    image = os.path.join(
            os.path.dirname(os.path.realpath(__file__)),
            "samples/blackpink/blackpink4.jpg")
    print("image path is: " + image)
    test_image = cv2.imread(image, cv2.IMREAD_COLOR)
    faces = face_detector.detect(test_image)

    for face in faces:
      cv2.rectangle(test_image,(int(face.x),int(face.y)),(int(face.x + face.w), int(face.y + face.h)), (0,255,0),3)

    window_name = "image"
    cv2.namedWindow(window_name, cv2.WND_PROP_AUTOSIZE)
    cv2.startWindowThread()

    cv2.imshow('image', test_image)
    cv2.waitKey(0)
    cv2.destroyAllWindows()
    cv2.waitKey(1)
    print("done showing face annotated image!")

    for face in faces:
      print(face.face_landmark)

    print("done") 
开发者ID:ildoonet,项目名称:deepface,代码行数:28,代码来源:test_scripts.py

示例12: test_ssd_webcam

# 需要导入模块: import cv2 [as 别名]
# 或者: from cv2 import startWindowThread [as 别名]
def test_ssd_webcam():
    cap = cv2.VideoCapture(0)
    # Define the codec and create VideoWriter object
    fourcc = cv2.VideoWriter_fourcc(*'MP4V')
    out = cv2.VideoWriter('ssd_output.mp4', fourcc, 60.0, (640, 480))

    face_detector = FaceDetectorSSDMobilenetV2()
    while(True):
        ret, frame = cap.read()

        test_image = frame
        faces = face_detector.detect(test_image)

        for face in faces:
          cv2.rectangle(test_image,(int(face.x),int(face.y)),(int(face.x + face.w), int(face.y + face.h)), (0,255,0),3)

        window_name = "image"
        cv2.namedWindow(window_name, cv2.WND_PROP_AUTOSIZE)
        cv2.startWindowThread()

        out.write(test_image)
        cv2.imshow(window_name, test_image)

        if cv2.waitKey(5) & 0xFF == ord('q'):
            break

    cap.release()
    out.release()
    cv2.destroyAllWindows() 
开发者ID:ildoonet,项目名称:deepface,代码行数:31,代码来源:test_scripts.py

示例13: imshow

# 需要导入模块: import cv2 [as 别名]
# 或者: from cv2 import startWindowThread [as 别名]
def imshow(image):
    import cv2 as cv
    if isinstance(image, str):
        image = cv.imread(image)
    cv.startWindowThread()
    cv.namedWindow('Image', cv.WINDOW_NORMAL)
    cv.imshow('Image', image) 
开发者ID:BCV-Uniandes,项目名称:AUNets,代码行数:9,代码来源:get_augmentation.py

示例14: imshow

# 需要导入模块: import cv2 [as 别名]
# 或者: from cv2 import startWindowThread [as 别名]
def imshow(image, name=0):
    import cv2 as cv
    if isinstance(image, str):
        image = cv.imread(image)
    cv.startWindowThread()
    cv.namedWindow(str(name), cv.WINDOW_NORMAL)
    cv.imshow(str(name), image) 
开发者ID:BCV-Uniandes,项目名称:AUNets,代码行数:9,代码来源:OF_resizeBP4D.py

示例15: __init__

# 需要导入模块: import cv2 [as 别名]
# 或者: from cv2 import startWindowThread [as 别名]
def __init__(self, src, window_name=None, org=None):
        self.src = src
        self.window_name = window_name if window_name else src

        cv2.startWindowThread()
        cv2.namedWindow(self.window_name, cv2.WINDOW_AUTOSIZE)
        if org:
            # Set the window position
            x, y = org
            cv2.moveWindow(self.window_name, x, y)

        super(DisplayVideo, self).__init__() 
开发者ID:jagin,项目名称:image-processing-pipeline,代码行数:14,代码来源:display_video.py


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