Ich benutze OpenCV 2.4.6 auf Ubuntu 13.04 (auf einem Acer C7 Chromebook), und ich verwende ein einfaches Testprogramm, um zu sehen, ob meine Webcam damit arbeiten wird OpenCV. Es funktioniert gut mit Käse und Skype, also weiß ich, dass die Webcam selbst nicht das Problem ist.OpenCV VideoCapture kann überhaupt nicht von meiner Webcam lesen
Hier ist mein Code (die ohne Fehler kompiliert):
#include "opencv2/opencv.hpp"
#include <stdio.h>
#include <stdlib.h>
using namespace std;
using namespace cv;
int main(int argc, char *argv[])
{
cv::VideoCapture cap;
if(argc > 1)
{
cap.open(string(argv[1]));
}
else
{
cap.open(CV_CAP_ANY);
}
if(!cap.isOpened())
{
printf("Error: could not load a camera or video.\n");
}
Mat frame;
namedWindow("video", 1);
for(;;)
{
waitKey(20);
cap >> frame;
if(!frame.data)
{
printf("Error: no frame data.\n");
break;
}
imshow("video", frame);
}
}
Wenn ich das Programm ohne Argumente laufen (da ich es will CV_CAP_ANY verwenden), I
bekommenError: could not load a camera or video.
init done
opengl support available
libpng warning: Application built with libpng-1.2.49 but running with 1.5.12
libpng warning: Application built with libpng-1.2.49 but running with 1.5.12
libpng warning: Application built with libpng-1.2.49 but running with 1.5.12
libpng warning: Application built with libpng-1.2.49 but running with 1.5.12
libpng warning: Application built with libpng-1.2.49 but running with 1.5.12
libpng warning: Application built with libpng-1.2.49 but running with 1.5.12
libpng warning: Application built with libpng-1.2.49 but running with 1.5.12
libpng warning: Application built with libpng-1.2.49 but running with 1.5.12
libpng warning: Application built with libpng-1.2.49 but running with 1.5.12
libpng warning: Application built with libpng-1.2.49 but running with 1.5.12
Error: no frame data.
wenn ich angeben/dev/video0 (meine einzige Kamera) als Argument, erhalte ich
demux_wavpack: (open_wv_file:127) open_wv_file: non-seekable inputs aren't supported yet.
(ERROR)icvOpenAVI_XINE(): Unable to open source '/dev/video0'
init done
opengl support available
libpng warning: Application built with libpng-1.2.49 but running with 1.5.12
libpng warning: Application built with libpng-1.2.49 but running with 1.5.12
libpng warning: Application built with libpng-1.2.49 but running with 1.5.12
libpng warning: Application built with libpng-1.2.49 but running with 1.5.12
libpng warning: Application built with libpng-1.2.49 but running with 1.5.12
libpng warning: Application built with libpng-1.2.49 but running with 1.5.12
libpng warning: Application built with libpng-1.2.49 but running with 1.5.12
libpng warning: Application built with libpng-1.2.49 but running with 1.5.12
libpng warning: Application built with libpng-1.2.49 but running with 1.5.12
libpng warning: Application built with libpng-1.2.49 but running with 1.5.12
GStreamer Plugin: Embedded video playback halted; module source reported: Could not read from resource.
Error: no frame data.
wenn ich den Pfad angeben, eine Videodatei als Argument, es spielt das Video einwandfrei.
Ich würde jede Hilfe zu schätzen wissen. Danke im Voraus!
Wow. Das hat mich für die letzte Woche überhäuft, also bin ich froh, dass sie es heute heiß gemacht haben. Ich danke dir sehr! – Jragon
Sie sind herzlich willkommen;) – Poko
Ich habe gerade entfernt 2.4.6 und installieren 2.4.6.1, und mein Code funktioniert perfekt! – Jragon