0

I want to access my iPhone 11 camera and take picture/video from my laptop (Windows 10) using python. I found the IP address of the camera using "IP Webcam" app. My phone and my laptop use the same WiFi network. When I run the python code below:

    import requests
    import numpy as np
    import cv2
    
# phone ip address:xx.xx.xx.xx
    while True:
        images=requests.get("xx.xx.xx.xx:8888/shot.jpg")
        video=np.array(bytearray(images.content),dtype=np.uint8)
        render=cv2.imdecode(video,-1)
        cv2.imshow('frame',render)
        if (cv2.waitkey(1) and 0xFF==ord('q')):
            break

I get this error:

No connection adapters were found for 'xx.xx.xx.xx:8888/shot.jpg'

How can I solve this issue?

Thank you for your help in advance.

Abbas

Abbas
  • 71
  • 1
  • 8
  • Does this answer your question? [Python Requests - No connection adapters](https://stackoverflow.com/questions/15115328/python-requests-no-connection-adapters) – Random Davis Sep 11 '20 at 21:20
  • Hi,Thank you for your help.I edited my code based on the link that you sent. I put my camera on photo mode and run the code. However, I got this error : No connection could be made because the target machine actively refused it. How can I solve this issue? , Thank you, Abbas – Abbas Sep 14 '20 at 14:56
  • Is the IP actually verified as working? Is it just Python that can't access it? – Random Davis Sep 14 '20 at 15:53
  • When I run the "IP Webcam" software on my phone and type its IP address on the browser on my laptop, I can access the camera on my laptop. However, if I just type the IP address on the browser, it is not working. Moreover, I can not connect using the python code (Windows 10) with the camera mode on my phone. – Abbas Sep 15 '20 at 16:25
  • Sounds like the PC with the browser you're using isn't on the same network as the phone and so can't access it. If you can't access it on that PC via the browser, of course Python won't work as well. Figure out how to get basic browser access working, then the Python part might start working. – Random Davis Sep 15 '20 at 16:27
  • Thank you for your help. However, my phone and my laptop are on the same network. I found the IP address of my phone from its settings and it is the same as IP address on "IP Webcam" software. I do not know why I can access via browser and the software, but not without it. Thanks, Abbas – Abbas Sep 18 '20 at 18:44
  • Hi, I can access my phone's camera via my laptop using Python and "IP Webcam" software. I can also save video and picture. However, the saved files have low resolution (480*360). I need to save them in HD (1080p) resolution. How can I do that? Thank you, Abbas – Abbas Sep 21 '20 at 16:08
  • the rules of this site are that you should ask that as a new, separate question – Random Davis Sep 21 '20 at 16:10
  • Thank you for letting me know. I will ask this as a new question. Abbas – Abbas Sep 23 '20 at 13:39

0 Answers0