惯例成果震楼
效果没有想象的好,但也勉强够看了,代码如下:
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/core/core.hpp>
using namespace cv;
int main() {
VideoCapture cap(0);
Mat frame;
while (waitKey(30) != 27)
{
cap >> frame;
imshow("原图", frame);
//灰度
cvtColor(frame, frame, CV_BGR2GRAY);
// 设置中值滤波器参数
medianBlur(frame, frame, 7);
// 拉普拉斯边缘检测
Laplacian(frame, frame, CV_8U, 5);
threshold(frame, frame, 127, 255, THRESH_BINARY_INV);
imshow("素描风", frame);
}
}
惯例opencv配置环境地址:http://blog.csdn.net/zmdsjtu/article/details/52235056
最后祝大家opencv使用愉快~