zhangwm-pt / prebuilt_whl

12 stars 3 forks source link

OpenCV does not support IP camera stream. #6

Open StreakingJerry opened 8 months ago

StreakingJerry commented 8 months ago
sipeed@lpi4a:~$ source ai/venv/bin/activate
(venv) sipeed@lpi4a:~$ python
Python 3.11.4 (main, Jun  7 2023, 10:13:09) [GCC 12.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import cv2
>>> cap = cv2.VideoCapture("http://192.168.50.232:81/stream")
[ERROR:0] global /mnt/git/github/opencv-python/opencv/modules/videoio/src/cap.cpp (164) open VIDEOIO(CV_IMAGES): raised OpenCV exception:

OpenCV(4.5.4) /mnt/git/github/opencv-python/opencv/modules/videoio/src/cap_images.cpp:253: error: (-5:Bad argument) CAP_IMAGES: can't find starting number (in the name of file): 192.168.50.232:81/stream in function 'icvExtractPattern'
zhangwm-pt commented 8 months ago
  1. you can try the local video stream to determine whether the function of obtaining video frames is normal.
  2. see if the same code executes normally on an arm or x86 machine.
  3. you can try to check the source code of OpenCV to determine whether you need to add additional dependencies and recompile.
StreakingJerry commented 8 months ago

1/2, the usb driver not functioning on my usb camera, so I can not test it. However I tried this code on my raspberry pi with the same version of python and opencv and it works. So both the camera and opencv should be okay.

3, I tried to use pip to install opencv but there is an error during the compiling. The error is about numpy and the message is quite a lot so I think you can easily reproduce it.

zhangwm-pt commented 8 months ago

For point 3, you can refer to the official compilation instructions of opencv to compile instead of using pip to compile. If you find problems because of this, you can report errors in the opencv community. I am not the maintainer of opencv and I don’t know how to solve its compilation errors.