处理视频不起作用

时间:2014-06-15 18:47:00

标签: video processing

我正在使用Processing 2.2.1。

我按照以下步骤操作:http://wiki.processing.org/w/Video_Issues

我的视频仍无效。没有错误,但图像是黑色的。

我已经安装了QuickTime 7.7.5和WinVDIG 1.0.1。当我运行QTCap时,图像也是黑色的,但是当我打开视频设置时,我看到自己......

在处理中,这是测试视频是否正常工作的代码:

import processing.video.*;


Capture video;


void setup() {
  size(320,240);
   String[] cameras = Capture.list();

   if (cameras.length == 0) {
    println("There are no cameras available for capture.");
    exit();
  } else {
    println("Available cameras:");
    for (int i = 0; i < cameras.length; i++) {
      println(cameras[i]);
    }
  }

  video = new Capture(this,320,240,30);
}

void draw() {

  if (video.available()) {
    println("video");
    video.read();
  }
  else{
  println("no video");
  }
 image(video,0,0);
}

控制台向我显示:

Available cameras:
    name=Lenovo EasyCamera,size=640x480,fps=5
    name=Lenovo EasyCamera,size=640x480,fps=30
    name=Lenovo EasyCamera,size=352x288,fps=5
    name=Lenovo EasyCamera,size=352x288,fps=30
    name=Lenovo EasyCamera,size=320x240,fps=5
    name=Lenovo EasyCamera,size=320x240,fps=30
    name=Lenovo EasyCamera,size=176x144,fps=5
    name=Lenovo EasyCamera,size=176x144,fps=30
    name=Lenovo EasyCamera,size=160x120,fps=5
    name=Lenovo EasyCamera,size=160x120,fps=30
    name=Lenovo EasyCamera,size=1280x960,fps=5
    name=Lenovo EasyCamera,size=1280x960,fps=15/2
    name=Lenovo EasyCamera,size=1280x1024,fps=5
    name=Lenovo EasyCamera,size=1280x1024,fps=15/2
    no video
    no video
    no video

1 个答案:

答案 0 :(得分:3)

这一行之后:

video = new Capture(this,320,240,30);

您需要start();添加以下内容:

video.start();

如果没有这个,捕捉就不会开始,你会看到黑屏。

请在此处查看documentation