Accessing a webcam with OpenCV

edited October 2013 in Library Questions

I've got this code from a book (which is meant to show the webcam)

import hypermedia.video.*;
OpenCV opencv;

void setup(){
 size(1280,720);

opencv= new OpenCV(this);
opencv.capture(width,height);
}

void draw(){
 opencv.read();
opencv.flip(OpenCV.FLIP_HORIZONTAL);
image(opencv.image(),0,0);
}

All it does is open a black window (the size of the size();). Nothing comes up as an error in the redish bar that appears at the bottom, but this happens in the box at the bottom in red.

2013-10-27 15:26:21.350 java[6731:16e03] Opening shmem segment com.allocinit.CTCtrl2
2013-10-27 15:26:21.351 java[6731:16e03] Opening shmem segment com.allocinit.CTImg2.0
2013-10-27 15:26:21.351 java[6731:16e03] Opening shmem segment com.allocinit.CTImg2.1
SGIdle failed in icvGrabFrame_QT_Cam with error -1
DVFreeThread - CFMachPortCreateWithPort hack = 0x209d9e0, fPowerNotifyPort= 0x209d350

Does anyone know how to fix this? Thanks

Sign In or Register to comment.