简体   繁体   English

实时从我的 java openCV 应用程序通过 USB 访问安卓手机摄像头

[英]Accessing android phone Camera thru USB from my java openCV application in real time

I'm trying to learn computer vision with OpenCV and i need camera to work with but the only camera that i have is on my android phone.我正在尝试使用 OpenCV 学习计算机视觉,我需要使用相机,但我唯一拥有的相机是在我的 android 手机上。

So im thinking about connecting it to my pc (via USB) and using it with my application.所以我正在考虑将它连接到我的电脑(通过 USB)并与我的应用程序一起使用。 Is anything like that possible?有可能吗? Can i take information from camera connected via usb in real time?我可以从通过 USB 连接的相机实时获取信息吗?

I have no experience with something like this.我没有这样的经验。 I know i can just record video ,save it,put it on my pc, and use it as resource -bud i would prefer to have real time streaming of video while my application will work in background on my desktop computer.我知道我可以只录制视频,保存它,把它放在我的电脑上,并将其用作资源 - 我更喜欢实时流式传输视频,而我的应用程序将在我的台式计算机的后台运行。

Will i have to code some android application to get this working?Or can i simple ask for that data from my desktop application?我是否必须编写一些 android 应用程序才能使其正常工作?或者我可以简单地从我的桌面应用程序中请求该数据吗?

If you only want to experiment and learn to use OpenCV, you can get an IP Camera app for your phone and then read the image stream from your computer ( here's an example of how to do that).如果您只想尝试并学习使用 OpenCV,您可以为您的手机获取一个IP 摄像头应用程序,然后从您的计算机读取图像流( 是如何执行此操作的示例)。 That is the easiest "real time-ish" solution I can think of.这是我能想到的最简单的“实时”解决方案。

I found a simple way to use the a web cam (IP Webcam installed on my smartphone through Play Store) as camera using OpenCV and Java.我找到了一种使用 OpenCV 和 Java 将网络摄像头(通过 Play 商店安装在我的智能手机上的 IP 网络摄像头)用作摄像头的简单方法。 Here is how: just copy the IP Webcam web link inside the Video Capture.方法如下:只需复制 Video Capture 中的 IP 网络摄像头网络链接即可。 Like this.像这样。

org.opencv.videoio.VideoCapture webSource = new VideoCapture("http://192.168.43.1:8080/video"); 

The smartphone and the laptop should be inside the same Wi-Fi.智能手机和笔记本电脑应该在同一个 Wi-Fi 中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM