This is my first post in stackoverflows forum.
I like to refer this sarxos answer https://stackoverflow.com/a/31871593/5510077
I think I have followed API's creator Bartosz Firyns instructions exactly to get his Webcam Capture 0.3.10 API to work on my Raspberry Pi Model B+.
Files I have currently included in my classpath are:
I use this sarxos's example to test API, but using V4l4jDriver, because I can't get BridJ work on Raspberry Pi :
package webcam;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import javax.imageio.ImageIO;
import com.github.sarxos.webcam.Webcam;
import com.github.sarxos.webcam.ds.v4l4j.V4l4jDriver;
public class WebCam {
static {
Webcam.setDriver(new V4l4jDriver()); // this is important
}
public static void main(String[] args) throws IOException {
// get default webcam and open it
Webcam webcam = Webcam.getDefault();
webcam.open();
// get image
BufferedImage image = webcam.getImage();
// save image to PNG file
ImageIO.write(image, "PNG", new File("test.png"));
}
}
and receive this error:
[main] WARN com.github.sarxos.webcam.ds.v4l4j.V4l4jDriver - Modified V4L4J has not been found in classpath
Exception in thread "main" com.github.sarxos.webcam.WebcamException: java.util.concurrent.ExecutionException: java.lang.NullPointerException
at com.github.sarxos.webcam.WebcamDiscoveryService.getWebcams(WebcamDiscoveryService.java:124)
at com.github.sarxos.webcam.Webcam.getWebcams(Webcam.java:816)
at com.github.sarxos.webcam.Webcam.getDefault(Webcam.java:879)
at com.github.sarxos.webcam.Webcam.getDefault(Webcam.java:856)
at com.github.sarxos.webcam.Webcam.getDefault(Webcam.java:834)
at webcam.WebCam.main(WebCam.java:34)
Caused by: java.util.concurrent.ExecutionException: java.lang.NullPointerException
at java.util.concurrent.FutureTask.report(FutureTask.java:122)
at java.util.concurrent.FutureTask.get(FutureTask.java:192)
at com.github.sarxos.webcam.WebcamDiscoveryService.getWebcams(WebcamDiscoveryService.java:116)
... 5 more
Caused by: java.lang.NullPointerException
at com.github.sarxos.webcam.util.NixVideoDevUtils.getVideoFiles(NixVideoDevUtils.java:19)
at com.github.sarxos.webcam.ds.v4l4j.V4l4jDriver.getDevices(V4l4jDriver.java:46)
at com.github.sarxos.webcam.WebcamDiscoveryService$WebcamsDiscovery.call(WebcamDiscoveryService.java:36)
at com.github.sarxos.webcam.WebcamDiscoveryService$WebcamsDiscovery.call(WebcamDiscoveryService.java:26)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Java Result: 1
These links are dead so I can't test these jar-files:
webcam-capture-0.3.11-SNAPSHOT.jar
webcam-capture-driver-v4l4j-0.3.11-20150713.101304-10.jar
Is there anything to do to get this API working on Raspberry Pi on these days?
You get rid of the error and application running when you replace two files:
with this one:
and
with this one
Links to these files and answered ticket from Webcam Capture API author to missing links.