This repository provides an experimental Unity sample project intended for research, evaluation, and technical verification of USB-connected camera usage in Android-based Unity applications.
It integrates [USB Camera for Unity Android] and [OpenCV for Unity] to demonstrate how to acquire video streams from USB web cameras and apply OpenCV-based image processing directly on Android devices.
By using the helper class USBCamera2MatHelper, USB camera frames can be converted into OpenCV Mat format, making it easy to apply existing OpenCVForUnity sample code and image processing workflows.
Please note that this helper class currently supports only a single USB camera connection at a time.
As important limitations, [USB Camera for Unity Android] requires the graphics API to be set to OpenGLES3. In addition, depending on the connected camera model, the application may crash when the USB device is unplugged.
It is recommended to test the behavior with your camera hardware using the demo application provided on the [USB Camera for Unity Android] Asset Store page before integrating it into your own project.
- Android (Pixel, Galaxy S10+)
- Unity 2021.3.45f2 / OpenGLES3
- USB Camera for Unity Android 2.1.0
- OpenCV for Unity 3.0.1+
- Download the latest release unitypackage. USBCameraWithOpenCVForUnityExample.unitypackage
- Create a new project. (
USBCameraWithOpenCVForUnityExample)- Change the platform to
Androidin the "Build Settings" window.
- Change the platform to
- Import and setup the
USB Camera for Unity Android. Refer to theReadMe.pdfon the Asset Store introduction page. - Import and setup the
OpenCV for Unity. - Import the
USBCameraWithOpenCVForUnityExample.unitypackage. - Add the "Assets/USBCameraWithOpenCVForUnityExample/*.unity" files to the "Scenes In Build" list in the "Build Settings" window.
- Build and Deploy.
