600字范文,内容丰富有趣,生活中的好帮手!
600字范文 > termux python 打开摄像头_python+opencv 电脑调用手机的摄像头

termux python 打开摄像头_python+opencv 电脑调用手机的摄像头

时间:2023-09-12 03:58:42

相关推荐

termux python 打开摄像头_python+opencv 电脑调用手机的摄像头

移动端下载一个工具:IP摄像头(app)

下载安装后,打开app后,点击下方的“打开IP摄像头服务器”(连上wifi,确保电脑与手机处在同一局域网内)。

然后,使用python进行opencv代码调用部分:

import cv2

cv2.namedWindow("camera",1)

#开启ip摄像头

video="http://admin:admin@192.168.1.5:8081/" #此处@后的ipv4 地址需要改为app提供的地址

cap =cv2.VideoCapture(video)

while True:

# Start Camera, while true, camera will run

ret, image_np = cap.read()

# Set height and width of webcam

height = 600

width = 1000

# Set camera resolution and create a break function by pressing 'q'

cv2.imshow('object detection', cv2.resize(image_np, (width, height)))

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

cap.release()

cv2.destroyAllWindows()

break

# Clean up

cap.release()

cv2.destroyAllWindows()

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。