7. Running Android as IP Camera With OpenCV - NaimFuad/RaspberryPiWithOpenCV GitHub Wiki
1.On your Android phone, download, install, and launch the application called IP Webcam by Pavel Khlebovich.
Make sure all device is connected to the same network
- Note down the IP address of your camera server i.e. http://192.168.XX.XX:8080
- Scroll down the menu and choose Start Server.
- On Raspberry Pi, create a new Python script by copy paste the given code. On the 4th line edit the camera server address as follows:
import cv2
import numpy as np
import time
cap=cv2.VideoCapture('http://192.168.XX.XX:8080/video')
cap.set(3,320) #set heigt >>refer propId
cap.set(4,240) #set width
time.sleep(0.1)
while True:
ret,frame = cap.read()
cv2.imshow('frame',frame)
if cv2.waitKey(1)&0xFF == ord('q'):
break
cap.release()
cv2.destroyAllWindows()