私はopenCV 2.3.1を使用してIPカメラに接続しています。ここでOpenCV 2.3.1を使用してIPカメラに接続するには?
は()関数は常にnullを返しますが、私はcvCreateFileCaptureを使用する場合( "video.avi")私のコード
#include "../../../OpenCV/include/opencv/cv.h"
#include "../../../OpenCV/include/opencv/highgui.h"
CvCapture *camera = cvCreateFileCapture("http://usr:[email protected]:port/nphMotionJpeg?resolution=320x240&Quality=Standard");
if (camera == NULL)
printf("camera is null\n");
else
printf("camera is not null");
cvNamedWindow("img");
int d = cvWaitKey(10);
while (d != atoi("q"))
{
d = cvWaitKey(10);
double t1 = (double)cvGetTickCount();
IplImage *img = cvQueryFrame(camera);
double t2=(double)cvGetTickCount();
printf("time: %gms fps: %.2g\n",(t2-t1)/(cvGetTickFrequency()*1000.), 1000./((t2-t1)/(cvGetTickFrequency()*1000.)));
cvShowImage("img",img);
}
cvReleaseCapture(&camera);
しかしcvCreateFileCapture以上でOKですが、なぜ私に説明してください?
私はこの問題について多くのスレッドをstackoverflow.comで読んでいますが、まだこの問題を解決する方法はありません。
私はOpenCV 2.3.1を使用していますが、ffmpegでビルドしました(これはわかりませんが、ビルド後に私のフォルダにopencv_ffmpeg.dllがあります)。
'cvCreateFileCapture'はローカルファイルだけをサポートしているようです。 –