Ask Your Question

Revision history [back]

I think the issue is you need to initialise the Mat instance you pass to Its currently null in your code.

Mat image = new Mat();

Also, read() also performs both a grab() and retrieve() internally, so you don't need to call grab() beforehand.

while (i<10) {
        try {
        } catch (Exception e) {
            System.out.println("Null Pointer Exception during Read");

I had a similar issue earlier, hope this helps!