From e12cf1b77b8e0c22e4edfe413a5d36e684a130b7 Mon Sep 17 00:00:00 2001 From: AdityaShimpi <98681601+AdityaShimpi@users.noreply.github.com> Date: Sun, 30 Jan 2022 22:09:48 +0530 Subject: [PATCH] imported cv2 as cv --- .../cv2_capture_live_video_from_camera.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/03-Open-Camera/cv2_capture_live_video_from_camera.py b/03-Open-Camera/cv2_capture_live_video_from_camera.py index 275c14f..dee6cbe 100644 --- a/03-Open-Camera/cv2_capture_live_video_from_camera.py +++ b/03-Open-Camera/cv2_capture_live_video_from_camera.py @@ -1,22 +1,22 @@ -import cv2 +import cv2 as cv # 1.打开摄像头 -capture = cv2.VideoCapture(2) +capture = cv.VideoCapture(2) # 2.获取捕获的分辨率 width, height = capture.get(3), capture.get(4) print(width, height) # 以原分辨率的一倍来捕获, # 参数1可以直接写数字,或者OpenCV符号表示 -capture.set(cv2.CAP_PROP_FRAME_WIDTH, width * 2) -capture.set(cv2.CAP_PROP_FRAME_HEIGHT, height * 2) +capture.set(cv.CAP_PROP_FRAME_WIDTH, width * 2) +capture.set(cv.CAP_PROP_FRAME_HEIGHT, height * 2) while(True): # 获取一帧 ret, frame = capture.read() # 将这帧转换为灰度图 - gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY) + gray = cv.cvtColor(frame, cv.COLOR_BGR2GRAY) - cv2.imshow('frame', gray) - if cv2.waitKey(1) == ord('q'): + cv.imshow('frame', gray) + if cv.waitKey(1) == ord('q'): break pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy