【发布时间】:2017-05-13 18:23:39
【问题描述】:
如果您有任何源代码,请让我知道,如果您有使用 c++ 使用 opencv 3.0.0 在视频中画线的源代码 亲切地
【问题讨论】:
标签: visual-c++ opencv3.0
如果您有任何源代码,请让我知道,如果您有使用 c++ 使用 opencv 3.0.0 在视频中画线的源代码 亲切地
【问题讨论】:
标签: visual-c++ opencv3.0
首先,您应该考虑到视频基本上只是一些快速显示的图像。因此,您只需要知道如何在图像上画一条线以在视频中绘制它(对每一帧都做同样的事情)。 cv::line 函数记录在这里:http://docs.opencv.org/3.0-beta/modules/imgproc/doc/drawing_functions.html。
int main(int argc, char** argv)
{
// read the camera input
VideoCapture cap(0);
if (!cap.isOpened())
return -1;
Mat frame;
/// Create Window
namedWindow("Result", 1);
while (true) {
//grab and retrieve each frames of the video sequentially
cap >> frame;
//draw a line onto the frame
line(frame, Point(0, frame.rows / 2), Point(frame.cols, frame.rows / 2), Scalar(0), 3);
//display the result
imshow("Result", frame);
//wait some time for the frame to render
waitKey(30);
}
return 0;
}
这将在您的网络摄像头的视频源上绘制一条水平的黑色 3 像素粗线。
【讨论】: