Driver connecting the video-capture-library by roxlu with the "Webcam Capture" Java library by sarxos
Benefits when used on Windows:
- Uses Microsoft Media Foundation for capturing webcam images, thus being compatible with some Windows 8 tablets that do not work with the default implementation used by the sarxos webcam library
- Ability to query and set webcam capture resolutions
- Lower CPU load than default implementation used by sarxos webcam capture library (Note: Make sure to use the same resolution when benchmarking CPU usage. This driver allows also to capture high resolution webcam images and CPU load increases the higher the resolution that is captured)
- Setup the sarxos webcam capture library for your project
- Download the library at https://github.com/sarxos/webcam-capture
- Include the webcam-capture-0.3.10.jar into your project
- Follow the examples given there to get the sarxos library up and running
- Setup this driver
- Download bin/webcam-capture-driver-native.jar and include it into your project
- Download the native libraries required by your system (see bin folder): * Windows: webcam-capture-driver-native-32.dll and webcam-capture-driver-native-64.dll (you may also just download the version matching the bitness of your Java Runtime) * Mac: libwebcam-capture-driver-native-64.dylib * Linux: not yet supported
- Make sure that the libraries are found by your Java Runtime: Either put them into your projects working directory or set the library path with "java -Djava.library.path=[insert path to dll or dylib here]"
- Add the following code in your project to use this driver: "Webcam.setDriver(new NativeWebcamDriver());"
- Checkout the master branch (including the submodules src/video-capture-library and src/libyuv)
- Use CMake to build:
- Download CMake at https://cmake.org/ (version 3.5.1 or above)
- Start CMake GUI
- Choose "src" as source folder
- Choose "build32" or "build64" as build folder (depending on the bitness your are going to build)
- Click "Configure"
- Specify the Generator. I use: * Windows: "Visual Studio 14 2015" (for 32 bit build) and "Visual Studio 14 2015 Win64" (for 64 bit build) * Mac: "Xcode"
- Click "Generate"
- Browse to the build folder and build with your native compiler, e.g. open WebcamCaptureDriverNative.sln on Windows and build "ALL_BUILD" and then build "INSTALL" to copy the required files to the "bin" directory