1.读视频文件或打开摄像头
VideoCapture cap;
if (argc > 1)
cap.open(argv[1]);
else
cap.open(0);
if (!cap.isOpened())
{
std::cerr << "Cannot read video. Try moving video file to sample directory." << std::endl;
return -1;
}
2.Convert OpenCV Mat type to IplImage * type. OpenCV Mat 类型转化为IplImage*指针类型
Mat srcImg; // Mat type variable .
IplImage *resIplPtr = NULL; // Initialize by NULL.
srcImg = imread(imagePath); // read image;
resIplPtr = &(IplImage(srcImg)); // Mat to IplImage Pointer
resIplPtr = NULL; // set as NULL.