1
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

iPhoneのDroidCamアプリとPC(Windows,Python,OpenCV)の接続

Posted at

iPhone:iPhone7
iOS:14.6
DroidCam:1.8.0

PC:
OS:Windows10
Python:3.9.4
OpenCV:4.5.1.48

上記の環境を同一のLANネットワークに接続し、
iPhoneのDroidCamの映像を
Windows上のPythonアプリで受信して表示できた

参考にしたページは以下
Connect/Dev47Apps

Connect with internet browsers (Android)

の記述を特に参考にした

キャプチャ結果の画像サイズは
水平:640、垂直:480

解像度指定する場合は、URLを以下のように変更する

cap.open('http://192.168.179.3:4747/video/force/1280x720')

スマホのIPアドレス:192.168.179.3
スマホのポート番号:4747
(IPアドレスとポート番号は、スマホのDroidCamアプリを起動すると表示される)
解像度指定 水平:1280、垂直:720

ソースは以下。

connect.py
# DroidCam接続
import cv2

cap = cv2.VideoCapture()
cap.open('http://192.168.179.3:4747/video')  # OK (480,640,3)

while(True):
    ret,frame = cap.read()
    cv2.imshow("remote" , frame)
    # qキー入力でwhileループを抜ける
    if cv2.waitKey(1) & 0xFF == ord('q'):
        break
 
# 撮影用オブジェクトとウィンドウの解放
cap.release()
cv2.destroyAllWindows()

1
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?