【发布时间】:2014-03-03 07:32:59
【问题描述】:
我正在尝试检索我的网络摄像头支持的可用图片尺寸分辨率;使用 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 - 只为你:))
-
看来这是OpenCV的一个bug,最近已经修复:code.opencv.org/issues/3387
-
我检查了另一个链接,它说他们应该使用 v2.4.9 发布修复程序。现在我可以休息了,非常感谢:)
-
500rep 赏金太糟糕了:)