您正在查看印刷版本的博客, 印刷版本的博客可能会缺少部分交互功能, 部分内容显示不全或过时. 如果您在查看该印刷版博客时遇到了任何问题, 欢迎来此链接查看在线版: https://www.kxxt.dev/blog/use-android-devices-as-cameras-in-opencv/
You are viewing a printed version of this blog. It may lack some interactive features and some content might now be fully displayed or outdated. If you encounter any problems while viewing this printed version of the blog, feel free to view the online version here: https://www.kxxt.dev/blog/use-android-devices-as-cameras-in-opencv/
- Android devices are common and cheap. You probably have tons of old phones.
- Within a normal wireless local area network, the latency is usually negligible for most use cases.
- Why not? It’s a good opportunity to make use of your old phones.
First, you need an android app which acts as a webcam.
I find droidcam a good fit.
The free version allows you to make your android phone a web cam with a resolution of
640x480. But it will add a watermark on the top left corner of the picture.
Then you can use your phone as an input source for OpenCV.
Of course, you can connect multiple android devices to OpenCV. It’s just a matter of creating multiple
I find if your android device locks its screen, you can no longer receive camera input. (Possibly due to Android 12 only allowing apps to use camera when the user is using them).
You can use an app like Wakey to circumvent this issue.
iriun is a good alternative to droidcam, but it only allows one connection at the same time, which means you can only use one android device as camera in your code at the same time.
iriun does implement something that droidcam doesn’t provide. It generates a virtual camera device so that you can use it as a normal camera in OpenCV: