Python cv2 模块,WND_PROP_FULLSCREEN 实例源码

我们从Python开源项目中,提取了以下2个代码示例,用于说明如何使用cv2.WND_PROP_FULLSCREEN

项目:pedestrianSys    作者:PhilipChicco    | 项目源码 | 文件源码
def stream(quit, det):
    """
    :param quit: Quit streaming
    :param det: detection object
    :return:
    """
    global sav_frame
    global sav_result

    camera_src = None
    if args.device == str(0):  # jetson
        camera_src = CameraSrc().get_cam_src()
    else:  # desktop
        camera_src = 0

    camera = cv2.VideoCapture(camera_src)
    assert camera.isOpened()

    if args.fullscreen:
        cv2.namedWindow(args.device, cv2.WINDOW_NORMAL)
        cv2.setWindowProperty(args.device,
                              cv2.WND_PROP_FULLSCREEN,
                              cv2.WINDOW_FULLSCREEN)
    face_locs = None
    alignedFace = None

    while True:
        _, frame = camera.read()
        sav_frame = frame.copy()

        # add frames to queue
        frame_queue.put(sav_frame)

        # display detection results
        #face_locs = face_coordinates_queue.get()
        #alignedFace = face_aligned_queue.get()

        #if face_locs is not None:
        #    print(len(alignedFace), face_locs)

        #det.display(frame=frame, face_locations=face_locs)

        cv2.imshow(args.device, frame)
        if cv2.waitKey(1) & 0xFF == ord('q'):
            quit.value = 1
            break

    camera.release()
    cv2.destroyAllWindows()


# Main Process
项目:Python-Learner    作者:fire717    | 项目源码 | 文件源码
def fullScreenCatch():
    global img,imgSmall,newGray,finishDraw

    base = ImageGrab.grab()
    base.save('fullScreen.png')

    img = cv2.imread("fullScreen.png")
    cv2.namedWindow("image", cv2.WND_PROP_FULLSCREEN)  
    cv2.moveWindow('image',0,0) #????????        
    cv2.setWindowProperty("image", cv2.WND_PROP_FULLSCREEN,cv2.WINDOW_FULLSCREEN)
    cv2.setMouseCallback('image',draw_rect)

    imgSmall = img.copy() #??????????

    imgGray = img.copy() #????
    imgGray = cv2.cvtColor(imgGray,cv2.COLOR_BGR2GRAY) 
    cv2.imwrite("fullGray.png", imgGray) #save and reread,?????????????
    newGray = cv2.imread("fullGray.png")

    finishDraw = False
    while(1):
        cv2.imshow('image',img)
        k=cv2.waitKey(2)&0xFF

        if k & finishDraw: 
            catchScreen(x1,y1,x2,y2)
            #img2word(img)
            #chinese_word=eng2chinese(word)
            chinese_word='waiting...'

            #show word when stop draw
            font=cv2.FONT_HERSHEY_SIMPLEX
            cv2.putText(img,chinese_word,(x1,y2+24), font, 0.8,(0,0,255),1)

            cv2.imshow('image',img)
            cv2.waitKey()
            break
    return