首页 > 学院 > 开发设计 > 正文

一些短代码

2019-11-06 09:09:32
字体:
来源:转载
供稿:网友

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.
上一篇:2017.2.27

下一篇:求最大值

发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表