10
我正在尝试检索我的网络摄像头支持的可用图片尺寸分辨率;使用OpenCV库。我曾尝试使用类似的Android问题/答案,但无济于事。 (例如Android camera supported picture sizes)。这里是我的代码:网络摄像头支持的图片尺寸
import org.opencv.highgui.VideoCapture;
import org.opencv.core.Size;
public class MyCameraCaptureClass {
public static void main(String[] args) {
System.out.println("Hello, OpenCV");
System.out.println("This program will display the webcam's supported sizes");
System.loadLibrary("opencv_java248"); //load .dll for the jar
VideoCapture vidCap0 = new VideoCapture(0);
if (vidCap0.isOpened()) {
System.out.println("Camera found, and it works so far...");
for (Size aSize : vidCap0.getSupportedPreviewSizes()) {
System.out.println("Doesn't print this at all");
System.out.println("Height:" + aSize.height + "Width:" + aSize.width);
}
}
vidCap0.release();
}
}
而且堆栈跟踪是:
Exception in thread "main" java.lang.Exception: unknown exception
at org.opencv.highgui.VideoCapture.getSupportedPreviewSizes_0(Native Method)
at org.opencv.highgui.VideoCapture.getSupportedPreviewSizes(VideoCapture.java:478)
at webcam.MyCameraCaptureClass.main(MyCameraCaptureClass.java:19)
所有帮助将衷心感谢。
您能否提供异常的堆栈跟踪? –
@Eugene Evdokimov - 只为你:)) – Koffy
看来这是OpenCV中的一个bug,最近已经修复:http://code.opencv.org/issues/3387 –