我之前编写过USB网络摄像头,其唯一目的是从摄像头获取实时帧并在窗口中显示.我为此目的使用了cvCaptureFromCAM,它适用于USB Camera(见下面的代码).
我想知道如何从千兆以太网相机中捕获帧?我想我需要使用一些API从一些默认IP地址捕获帧.有人能指出我正确的方向吗?
我将在Intel i3处理器上的Windows 7上使用C++和OpenCV.
#include "cv.h"
#include "highgui.h"
#include <stdio.h>
// A Simple Camera Capture Framework
int main() {
CvCapture* capture = cvCaptureFromCAM( CV_CAP_ANY );
if ( !capture ) {
fprintf( stderr, "ERROR: capture is NULL \n" );
getchar();
return -1;
}
// Create a window in which the captured images will be presented
cvNamedWindow( "mywindow", CV_WINDOW_AUTOSIZE );
// Show the image captured from the camera in the window and repeat
while ( 1 ) {
// Get …
Run Code Online (Sandbox Code Playgroud)