【发布时间】:2015-03-09 07:45:13
【问题描述】:
所以我决定我想了解图像处理和视觉跟踪等知识,因此安装了 opencv 并让它在 eclipse for Java 中运行。但是,当我尝试拍照时,我得到的只是一张图片,上面写着“请启动 Manycam 或选择其他视频源”
这是我正在使用的代码:
package testests;
import org.opencv.core.Core;
import org.opencv.core.Mat;
import org.opencv.highgui.Highgui;
import org.opencv.highgui.VideoCapture;
public class Hello
{
public static void main(String[] args)
{
System.out.println(System.getProperty("java.library.path"));
System.loadLibrary(Core.NATIVE_LIBRARY_NAME);
VideoCapture cap = new VideoCapture(0);
if (!cap.isOpened())
System.out.println("Not connected to webcam ):");
else
System.out.println("Connected to camera: " + cap);
Mat frame = new Mat();
cap.retrieve(frame);
System.out.println(frame);
Highgui.imwrite("test.jpg", frame);
cap.release();
}
}
任何帮助将不胜感激!
编辑:
我让它与 manycam 一起工作。但是,我想在没有 manycam 的情况下使用它,但我不知道该怎么做。每次我尝试该图像都会恢复
【问题讨论】: