See code below, running on 64 bits windows 7, jdk 1.7.0_04.
If not doing "invoke later", it works fine, but if do "invoke later", then it shows "org.openimaj.video.capture.VideoCaptureException: An error occured opening the capture device"
I think there is an issue if there are two threads using the grabber at the same time.
Anthony
--
public class TestVideoCapture {
private static void showWindows(final List<Device> devices) {
final int w = 320;
final int h = 240;
final double rate = 10.0;
for (int y = 0, i = 0; y < 3; y++) {
for (int x = 0; x < 3 && i < devices.size(); x++, i++) {
try {
final VideoCapture grabber2 = new VideoCapture(w, h, rate, devices.get(i));
final VideoDisplay<MBFImage> disp = VideoDisplay.createVideoDisplay(grabber2);
SwingUtilities.getRoot(disp.getScreen()).setLocation(320 * x, 240 * y);
}
catch (Throwable t) {
t.printStackTrace();
}
}
}
}
/**
* @param args
*/
public static void main(String[] args) throws VideoCaptureException {
final List<Device> devices = VideoCapture.getVideoDevices();
for (final Device d : devices)
System.out.println(d);
if (devices.size() == 1) {
final VideoCapture grabber1 = new VideoCapture(640, 480, devices.get(0));
VideoDisplay.createVideoDisplay(grabber1);
}
else {
showWindows(devices);
See code below, running on 64 bits windows 7, jdk 1.7.0_04.
If not doing "invoke later", it works fine, but if do "invoke later", then it shows "org.openimaj.video.capture.VideoCaptureException: An error occured opening the capture device"
I think there is an issue if there are two threads using the grabber at the same time.
Anthony
--
public class TestVideoCapture {
// SwingUtilities.invokeLater(new Runnable() {
//
// public void run() {
// showWindows(devices);
// }
// });
}
}
}