我对Processing OpenCV库有困难:
http://ubaa.net/shared/processing/opencv/index.html
我正在运行绝对最基本的可能示例代码:
import hypermedia.video.*;
OpenCV opencv;
void setup ()
{
opencv = new OpenCV( this );
opencv.capture( width, height );
}
void draw ()
{
opencv.read();
background( opencv.image() );
}
但每次都收到控制台消息:
SGIdle failed in icvGrabFrame_QT_Cam with error -1
并且没有视频输入。我的网络摄像头开启,但程序挂起。
我在网上遇到过这个问题的其他人,但我还没有找到一个来源。我觉得它与QuickTime的视频捕捉有关,但我不确定。
系统信息:
有谁知道发生了什么事?当库的最基本功能不起作用时,很难进入实际项目......
答案 0 :(得分:2)
使用视频库进行解决方法并将视频帧复制到openCV层:http://habu.phpfogapp.com/?p=3
答案 1 :(得分:0)
以下是使用标准库捕获图像
的变通方法示例// OpenCV cannot capture anymore since a iTunes or QuickTime update.
// It returns this error:
// SGIdle failed in icvGrabFrame_QT_Cam with error -1
// This example shows how to use standard video library to capture then
// pass the image to OpenCV.
//
// Pierre Rossel
// 25.2.2013
import hypermedia.video.*;
import processing.video.*;
OpenCV opencv;
Capture video;
int captureW = 640;
int captureH = 480;
void setup ()
{
size(captureW, captureH);
opencv = new OpenCV( this );
opencv.allocate(captureW, captureH);
opencv.threshold(255); // Clears allocated image
video = new Capture(this, captureW, captureH);
video.start();
}
void draw ()
{
if (video.available()) {
video.read();
opencv.copy(video);
}
background( opencv.image() );
}