目录
B站视频《OpenCV4 C++ 快速入门视频30讲 - 系列合集》
quickdemo.cpp
quickopencv.h
test440.cpp
下面为该课程中的全部源代码,纯手打,如有错误和其他问题,欢迎留言(涉及到的权重和图片代码等文件,如果需要请看评论区)
#include
void QuickDemo::colorSpace_Demo(Mat & image)
{
Mat gray, hsv;
cvtColor(image,hsv,COLOR_BGR2HSV);
cvtColor(image,gray,COLOR_BGR2GRAY);
imshow("HSV",hsv);
// H 范围0-180 ,S V通道0-255
//HS表示颜色 V表示亮度
//S可调整饱和度
imshow("灰度",gray);
imwrite("D:/opencvproject/Project32015/Lednahsv.jpg", hsv);
imwrite("D:/opencvproject/Project32015/Lednagray.jpg", gray);
}
void QuickDemo::mat_Creation_demo(Mat &image) {
//Mat m1, m2;
//m1 = image.clone();
//image.copyTo(m2);
//创建空白图像
Mat m3 = Mat::zeros(Size(8,8),CV_8UC3);
// zeros可换为ones ,但是注意 创建出来的三通道并不是全都是1,只有第一个通道B为1,其余为零
// 可用 Scalar(?,?,?); 为各个通道赋值
// CV_8UC3 表示8位 无符号数 3通道
std::cout << "宽度 " << m3.cols << " 高度:" << m3.rows << " channels:" << m3.channels() << std::endl;
std::cout << m3 << std::endl;
}
void QuickDemo::pixel_visit_demo(Mat &image) {
int w = image.cols;
int h = image.rows;
int dims = image.channels();
/*
for (int row = 0; row < h; row++) {
for (int col = 0; col < w; col++) {
if (dims == 1) { //灰度图像
int pv = image.at(row, col);
image.at(row, col) = 255 - pv;
}
if (dims == 3) { //彩色图像
Vec3b bgr = image.at(row, col);
image.at(row, col)[0] = 255 - bgr[0];
image.at(row, col)[1] = 255 - bgr[1];
image.at(row, col)[2] = 255 - bgr[2];
}
}
}
*/
//下面使用指针方法
for (int row = 0; row < h; row++) {
uchar *current_row = image.ptr(row);
for (int col = 0; col < w; col++) {
if (dims == 1) { //灰度图像
int pv = *current_row;
*current_row++ = 255 - pv;
}
if (dims == 3) { //彩色图像
Vec3b bgr = image.at(row, col);
*current_row++ = 255 - *current_row;
*current_row++ = 255 - *current_row;
*current_row++ = 255 - *current_row;
}
}
}
imshow("像素读写演示", image);
}
void QuickDemo::operators_demo(Mat &image) {
Mat dst;
dst = image + Scalar(50,50,50);
imshow("像素加减",dst);
}
void QuickDemo::testsubt(Mat &image0, Mat &image1) {
Mat dst,dst2;
subtract(image0,image1,dst);
add(image1, dst, dst2);
imshow("无雾减有雾图像相减",dst);
imwrite("dst.jpg", dst);
imshow("有雾气图像加相减结果", dst2);
imwrite("dst2.jpg", dst2);
}
Mat src, dst, m;
int lightness = 50;
static void on_lightness(int b ,void * userdata) {
Mat image = *((Mat*)userdata);
Mat dst = Mat::zeros(image.size(), image.type());
Mat m = Mat::zeros(image.size(), image.type());
//m = Scalar(b, b, b);
//suaddbtract(src, m, dst);
addWeighted(image, 1.0, m, 0, b, dst);
imshow("亮度与对比度调整",dst);
}
static void on_contrast(int b, void * userdata) {
Mat image = *((Mat*)userdata);
Mat dst = Mat::zeros(image.size(), image.type());
Mat m = Mat::zeros(image.size(), image.type());
double contrast = b / 100.0;
addWeighted(image, contrast, m, 0, 0, dst);
imshow("亮度与对比度调整", dst);
}
void QuickDemo::tracking_bar_demo(Mat &image) {
namedWindow("亮度与对比度调整",WINDOW_AUTOSIZE);
src = image;
int max_value = 100;
int lightness = 50;
int contrast_value = 100;
createTrackbar("Value Bar","亮度与对比度调整",&lightness,max_value,on_lightness,(void*)(&image));
createTrackbar("Contrast Bar", "亮度与对比度调整", &contrast_value, 200, on_contrast, (void*)(&image));
on_lightness(50,&image);
}
void QuickDemo::keyboard_demo(Mat &image) {
Mat dst = Mat::zeros(image.size(),image.type());
while (true) {
char c = waitKey(100);
if (c == 27) { //按 ESC 键,即退出
break;
}
if (c == 49) { //数字1
std::cout <<"You input the number "<< c << std::endl;
cvtColor(image,dst,COLOR_BGR2GRAY);
}
if (c == 50) {//数字2
std::cout << "You input the number " << c << std::endl;
cvtColor(image,dst,COLOR_BGR2HSV);
}
if (c == 51) {//数字3
std::cout << "You input the number " << c << std::endl;
dst = Scalar(50,50,50);
add(image, dst, dst);
}
imshow("键盘响应",dst);
}
}
void QuickDemo::color_style_demo(Mat &image){
int colormap[] = {
COLORMAP_AUTUMN,
COLORMAP_BONE,
COLORMAP_JET,
COLORMAP_WINTER,
COLORMAP_RAINBOW,
COLORMAP_OCEAN,
COLORMAP_SUMMER,
COLORMAP_SPRING,
COLORMAP_COOL,
COLORMAP_HSV,
COLORMAP_PINK,
COLORMAP_HOT,
COLORMAP_PARULA};
Mat dst;
int index = 0;
while (true) {
char c = waitKey(500);
if (c == 27) { //按 ESC 键,即退出
break;
}
applyColorMap(image,dst,colormap[index%13]);
index++;
imshow("颜色风格", dst);
}
}
void QuickDemo::bitwise_demo(Mat &image) {
Mat m1 = Mat::zeros(Size(256,256),CV_8UC3);
Mat m2 = Mat::zeros(Size(256, 256), CV_8UC3);
rectangle(m1, Rect(100, 100, 80, 80),Scalar(255, 255, 0), -1, LINE_8, 0); //-1表示填充
rectangle(m2, Rect(150, 150, 80, 80),Scalar(0,255, 255), -1, LINE_8, 0);
imshow("m1",m1);
imshow("m2", m2);
Mat dst;
bitwise_and(m1, m2, dst);
//bitwise_or(m1, m2, dst);
//bitwise_not(m1,dst);
//等价于 dst = ~m1;
//bitwise_xor(m1,dst);
imshow("像素位操作",dst);
}
void QuickDemo::channels_demo(Mat &image) {
std::vectormv;
split(image,mv);
imshow("蓝色通道", mv[0]);
imshow("绿色通道", mv[1]);
imshow("红色通道", mv[2]);
Mat dst;
mv[0] = 0;
//mv[1] = 0;
//mv[2] = 0;
merge(mv, dst);
imshow("?",dst);
int from_to[] = { 0,2,1,1,2,0 };
mixChannels(&image,1,&dst,1,from_to,3); //1 表示源图和目标图数量3个通道
imshow("通道混合",dst);
}
void QuickDemo::inrange_demo(Mat &image) {
Mat hsv;
cvtColor(image,hsv,COLOR_BGR2HSV);
Mat mask;
inRange(hsv,Scalar(35,43,46),Scalar(77,255,255),mask);
imshow("mask",mask);
Mat redback = Mat::zeros(image.size(),image.type());
redback = Scalar(40,40,200);
imshow("redback", redback);
bitwise_not(mask,mask);
imshow("masknot", mask);
image.copyTo(redback,mask);
imshow("roi区域提取",redback);
}
void QuickDemo::pixel_statistic_demo(Mat &image) {
double minv, maxv;
Point minLoc, maxLoc;
std::vectormv;
split(image, mv);
for (int i = 0; i < mv.size(); i++) {
minMaxLoc(mv[i], &minv, &maxv, &minLoc, &maxLoc, Mat()); //此函数要求目标图像为单通道
std::cout << "\n\nnum of channels:" << i << "\nmin value:" << minv << "\nmax value" << maxv;
}
Mat mean, stddev;
meanStdDev(image,mean,stddev);
std::cout << "\n\nmeans:\n" << mean << "\n\nstddev:\n" << stddev;
for (int i = 0; i < 3; i++) {
std::cout<<"\nmean of channel "<< i << " : "<(i, 0)<(i, 0) << std::endl;
}
}
void QuickDemo::drawing_demo(Mat &image) {
Rect rect;
rect.x = 100;
rect.y = 100;
rect.width = 250;
rect.height = 300;
Mat bg = Mat::zeros(image.size(), image.type());
rectangle(bg, rect, Scalar(255, 0, 0), -1, 8,0);//绘制长方形
circle(bg, Point(350, 400), 15, Scalar(255, 0, 0), -1, 8, 0);//绘制圆
line(bg, Point(100, 100), Point(350, 400), Scalar(0, 255, 0), 2, 8, 0); //绘制线
RotatedRect rrt;
rrt.center = Point(200,200);
rrt.size = Size(100,200);
rrt.angle = 0.0;
ellipse(bg,rrt,Scalar(0,255,255),2,8);//椭圆
Mat dst;
addWeighted(image, 1, bg, 0.5, 0, dst);
imshow("绘制演示", dst);
}
void QuickDemo::random_drawing() {
Mat canvas = Mat::zeros(Size(512, 512), CV_8UC3);
int w = canvas.cols;
int h = canvas.rows;
RNG rng(12345);
while (true) {
int c = waitKey(10);
if (c == 27) {
break;
}
int x1 = rng.uniform(0, w);
int y1 = rng.uniform(0, h);
int x2 = rng.uniform(0, w);
int y2 = rng.uniform(0, h);
line(canvas, Point(x1, y1), Point(x2, y2), Scalar(rng.uniform(0,255), rng.uniform(0, 255), rng.uniform(0, 255)), 1, LINE_AA,0);
imshow("绘制演示", canvas);
}
}
void QuickDemo::polyline_drawing_demo() {
Mat canvas = Mat::zeros(Size(512,512),CV_8UC3);
Point p1(100,100);
Point p2(350, 100);
Point p3(450, 280);
Point p4(320, 450);
Point p5(80, 400);
std::vector pts;
pts.push_back(p1);
pts.push_back(p2);
pts.push_back(p3);
pts.push_back(p4);
pts.push_back(p5);
// pts 点集合
//fillPoly(canvas,pts,Scalar(255,255,0),8,0); //可用此函数 进行多边形的填充
//polylines(canvas, pts, true, Scalar(0, 0, 255), 2, 8, 0);//此函数不能够填充
std::vector> contours; //存储点集的集合,存放多个多边形
contours.push_back(pts);
drawContours(canvas, contours,-1,Scalar(255,0,0),-1); //对多个多边形同时绘制
imshow("多边形绘制",canvas);
}
Point sp(-1, -1);
Point ep(-1,-1);
Mat temp;
static void on_draw(int event, int x, int y, int flags, void *userdata) {
Mat image = *((Mat*)userdata);
if (event == EVENT_LBUTTONDOWN) {
sp.x = x;
sp.y = y;
std::cout << "start point:" << sp << std::endl;
}
else if (event == EVENT_LBUTTONUP) {
ep.x = x;
ep.y = y;
int dx = ep.x - sp.x;
int dy = ep.y - sp.y;
if (dx > 0 && dy > 0) {
Rect box(sp.x, sp.y, dx, dy);
//temp.copyTo(image); 使得显示的ROI无红色框
imshow("ROI区域", image(box));
rectangle(image, box, Scalar(0, 0,255), 2, 8, 0);//绘制长方形
imshow("鼠标绘制", image);
sp.x = -1;
sp.y = -1;
}
}
else if (event == EVENT_MOUSEMOVE) {
if (sp.x > 0 && sp.y > 0){
ep.x = x;
ep.y = y;
int dx = ep.x - sp.x;
int dy = ep.y - sp.y;
if (dx > 0 && dy > 0) {
Rect box(sp.x, sp.y, dx, dy);
temp.copyTo(image);
rectangle(image, box, Scalar(0, 0, 255), 2, 8, 0);//绘制长方形
imshow("鼠标绘制", image);
}
}
}
}
void QuickDemo::mouse_drawing_demo(Mat &image) {
namedWindow("鼠标绘制",WINDOW_AUTOSIZE);
setMouseCallback("鼠标绘制",on_draw,(void*)(&image));
temp = image.clone();
imshow("鼠标绘制", image);
}
void QuickDemo::norm_demo(Mat &image) {
Mat dst;
std::cout << image.type();
image.convertTo(image,CV_32F); // CV_8UC3 ==> CV_32FC3
std::cout << image.type();
//imshow("图像fd", image); //opencv不能显示大于1的浮点
normalize(image,dst,1.0,0,NORM_MINMAX);
std::cout << dst.type() << std::endl;
imshow("图像norm", dst);
}
void QuickDemo::resize_demo(Mat &image) {
Mat zoomin, zoomout;
int h = image.rows;
int w = image.cols;
resize(image,zoomin,Size(w/2,h/2),0,0,INTER_LINEAR);
imshow("zoomin",zoomin);
resize(image, zoomout, Size(w *1.5, h *1.5), 0, 0, INTER_LANCZOS4);
imshow("zoomout", zoomout);
}
void QuickDemo::flip_demo(Mat &image) {
Mat dst;
flip(image,dst,-1); // 0 上下反转 ; 1 左右翻转 ; -1 上下左右翻转
flip(dst, dst, 1);
flip(dst, dst,0 );
imshow("翻转",dst);
}
void QuickDemo::rotate_demo(Mat &image) {
Mat dst, M;
int w = image.cols;
int h = image.rows;
M = getRotationMatrix2D(Point2f(w / 2, h / 2), 45, 1.0); //45度旋转,放缩1.0
//warpAffine(image, dst, M, image.size());
//warpAffine(image, dst, M, image.size(),INTER_LANCZOS4,0,Scalar(255,0,0));
double cos = abs(M.at(0, 0));
double sin = abs(M.at(0, 1));
double nw = cos*w + sin*h;
double nh = sin*w + cos*h;
M.at(0, 2) = M.at(0, 2) + (nw / 2 - w / 2);
M.at(1, 2) = M.at(1, 2) + (nh / 2 - w / 2);
warpAffine(image, dst, M, Size(nw,nh), INTER_LANCZOS4, 0, Scalar(255, 0, 0));
imshow("旋转",dst);
}
void QuickDemo::video_demo(Mat &image) {
//VideoCapture capture(0); //读取摄像头
VideoCapture capture("out.avi");//读取视频流
double frame_width = capture.get(CAP_PROP_FRAME_WIDTH); //获取视频宽高
double frame_height = capture.get(CAP_PROP_FRAME_HEIGHT);
double count = capture.get(CAP_PROP_FRAME_COUNT); // 视频 的 帧数
double fps = capture.get(CAP_PROP_FPS); //fps
std::cout << "宽 " << frame_width << "高" << frame_height << "帧数" << count << " FPS" << fps;
VideoWriter writer("testt.mp4", capture.get(CAP_PROP_FOURCC), fps, Size(frame_width, frame_height), true); // 保存视频第一步,编码格式不知道的话和原来保持一致(用CAP_PROP_FOURCC) ,Size为保存大小,true为颜色保持一致
Mat frame;
while (true) {
//flip(frame,frame,1); //镜像翻转 ,可以调用上面的方法进行处理,换背景,颜色空间转换等
capture.read(frame);
if (frame.empty()) {
break;
}
imshow("frame",frame);
colorSpace_Demo(frame);
writer.write(frame); // 保存视频第二步
int c = waitKey(10);
if (c == 27) { //按 ESC 键,即退出
break;
}
}
capture.release();
writer.release();// 保存视频第三步
}
void QuickDemo::showHistogram(Mat &image) {
//三通道分离
std::vectorbgr_plane;
split(image,bgr_plane);
//定义参数变量
const int channels[1] = { 0 };
const int bins[1] = { 256 };
float hranges[2] = {0,255};
const float* ranges[1] = { hranges };
Mat b_hist;
Mat g_hist;
Mat r_hist;
//计算B G R 通道的直方图
calcHist(&bgr_plane[0], 1, 0, Mat(), b_hist, 1, bins, ranges);
calcHist(&bgr_plane[1], 1, 0, Mat(), b_hist, 1, bins, ranges);
calcHist(&bgr_plane[2], 1, 0, Mat(), b_hist, 1, bins, ranges);
//显示直方图
int hist_w = 512;
int hist_h = 400;
int bin_w = cvRound((double)hist_w / bins[0]);
Mat histImage = Mat::zeros(hist_h,hist_w,CV_8UC3);
//归一化直方图数据
normalize(b_hist, b_hist, 0, histImage.rows, NORM_MINMAX, -1, Mat());
normalize(g_hist, g_hist, 0, histImage.rows, NORM_MINMAX, -1, Mat());
normalize(r_hist, r_hist, 0, histImage.rows, NORM_MINMAX, -1, Mat());
//绘制直方图曲线
for (int i = 1; i < bins[0]; i++) {
line(histImage, Point(bin_w*(i - 1), hist_h - cvRound(b_hist.at(i - 1))),
Point(bin_w*(i), hist_h - cvRound(b_hist.at(i))), Scalar(255, 0, 0), 2, 8, 0);
line(histImage, Point(bin_w*(i - 1), hist_h - cvRound(g_hist.at(i - 1))),
Point(bin_w*(i), hist_h - cvRound(g_hist.at(i))), Scalar(0, 0, 0), 2, 8, 0);
line(histImage, Point(bin_w*(i - 1), hist_h - cvRound(r_hist.at(i - 1))),
Point(bin_w*(i), hist_h - cvRound(r_hist.at(i))), Scalar(0, 0,255), 2, 8, 0);
}
namedWindow("HISTOGRAM DEMO",WINDOW_AUTOSIZE);
imshow("HISTOGRAM DEMO",histImage);
}
void QuickDemo::histogram_2d_demo(Mat &image) {
//2d 直方图
Mat hsv, hs_hist;
cvtColor(image,hsv,COLOR_BGR2HSV);
int hbins = 30, sbins = 32;
int hist_bins[] = { hbins,sbins };
float h_range[] = { 0,180 };
float s_range[] = { 0,256 };
const float* hs_ranges[] = { h_range,s_range };
int hs_channels[] = { 0,1 };
calcHist(&hsv, 1, hs_channels, Mat(), hs_hist, 2, hist_bins, hs_ranges, true, false);
double maxVal = 0;
minMaxLoc(hs_hist,0,&maxVal,0,0);
int scale = 10;
Mat hist2d_image = Mat::zeros(sbins * scale, hbins *scale, CV_8UC3);
for (int h = 0; h < hbins; h++) {
for (int s = 0; s < sbins; s++) {
float binVal = hs_hist.at(h, s);
int intensity = cvRound(binVal*255/maxVal);
rectangle(hist2d_image, Point(h * scale, s * scale),
Point((h + 1)*scale - 1, (s + 1)*scale - 1),
Scalar::all(intensity), -1);
}
}
applyColorMap(hist2d_image,hist2d_image,COLORMAP_PINK);
imshow("H-S histogram" , hist2d_image);
imwrite("hist_2d.png",hist2d_image);
}
void QuickDemo::histogram_eq_demo(Mat &image) {
Mat gray;
cvtColor(image,gray,COLOR_BGR2GRAY);
imshow("灰度图",gray);
Mat dst;
equalizeHist(gray,dst);
imshow("均衡化",dst);
}
void QuickDemo::blur_demo(Mat &image) {
Mat dst;
blur(image, dst, Size(13, 13), Point(-1,-1));
imshow("图形模糊", dst);
}
void QuickDemo::gaussian_blur_demo(Mat &image) {
Mat dst;
GaussianBlur(image, dst, Size(13, 13), 15);
imshow("图形模糊", dst);
}
void QuickDemo::bifilter_demo(Mat &image) {
Mat dst;
bilateralFilter(image, dst,0,100,10);
imshow("图形模糊", dst);
}
void QuickDemo::face_detect() {
std::string root_dir = "F:/opencv/sources/samples/dnn/face_detector/"; #修改为你的地址
dnn::Net net = dnn::readNetFromTensorflow(root_dir+"opencv_face_detector_uint8.pb",root_dir+"opencv_face_detector.pbtxt");
VideoCapture capture(0);
Mat frame;
while (true) {
capture.read(frame);
if (frame.empty()) {
break;
}
Mat blob = dnn::blobFromImage(frame, 1.0, Size(300, 300), Scalar(104, 177, 123), false, false); //Size此模型要求300*300
net.setInput(blob);//blob格式:NCHW
Mat probs = net.forward(); //输出:图像张的编号,图像的批次,框数,框的7个值
Mat detectionMat(probs.size[2],probs.size[3],CV_32F,probs.ptr());
//解析结果
//detectionmat 中 分别表示类型 index 得分
for (int i = 0; i < detectionMat.rows; i++) {
float confidence = detectionMat.at(i, 2);
if (confidence > 0.5) {
int x1 = static_cast(detectionMat.at(i, 3)*frame.cols);
int y1 = static_cast(detectionMat.at(i, 4)*frame.rows);
int x2 = static_cast(detectionMat.at(i, 5)*frame.cols);
int y2 = static_cast(detectionMat.at(i, 6)*frame.rows);
Rect box(x1, y1, x2 - x1, y2 - y1);
rectangle(frame,box,Scalar(0,0,255),2,8,0);
}
}
imshow("人脸检测演示", frame);
int c = waitKey(1);
if (c == 27) { //按 ESC 键,即退出
break;
}
}
}
#pragma once
#include
using namespace cv;
class QuickDemo {
public:
void colorSpace_Demo(Mat &image);//颜色空间转换
void mat_Creation_demo(Mat &image);//创建空白图像
void pixel_visit_demo(Mat &image);//像素查看
void operators_demo(Mat &image);//图片加减数值
void testsubt(Mat &image0,Mat &image1);//测试有无雾图片加减
void tracking_bar_demo(Mat &image);//拖动条响应
void keyboard_demo(Mat &image);//键盘响应
void color_style_demo(Mat &image);//颜色类型操作
void bitwise_demo(Mat &image); //位操作
void channels_demo(Mat &image);//通道合并与拆分
void inrange_demo(Mat &image);//图像色彩空间转换,抠图,换背景等
void pixel_statistic_demo(Mat &image);//图像像素值统计 均值 方差
void drawing_demo(Mat &image); //绘制长方形 圆形 椭圆
void random_drawing(); // 绘制随机数 与 随机颜色
void polyline_drawing_demo();//绘制多边形
void mouse_drawing_demo(Mat &image);// 鼠标响应绘制多边形
void norm_demo(Mat &image); //图像归一化
void resize_demo(Mat &image);//放缩
void flip_demo(Mat &image); // 镜像 翻转图像
void rotate_demo(Mat &image);//旋转
void video_demo(Mat &image); //视频
void showHistogram(Mat &image);//直方图
void histogram_2d_demo(Mat &image);//2d 直方图
void histogram_eq_demo(Mat &image);//直方图均衡化
void blur_demo(Mat &image); //均值模糊 卷积
void gaussian_blur_demo(Mat &image); //高斯模糊
void bifilter_demo(Mat &image); // 双边模糊,保留边缘 去掉噪声
void face_detect(); //人脸检测
};
注:图片可自行更改
#include
#include
#include
using namespace cv;
using namespace std;
int main(int argc, char **argv) {
Mat src = imread("D:\\opencvproject\\Project32015\\Project32015\\test.jpg");
Mat src0 = imread("D:\\opencvproject\\Project32015\\Project32015\\hsos0.png");
Mat src1 = imread("D:\\opencvproject\\Project32015\\Project32015\\hsos1.png");
Mat src2 = imread("D:\\opencvproject\\Project32015\\Project32015\\green.png");
if (src.empty()) {
printf("could not load image\n");
waitKey(0);
return -1;
}
//namedWindow("输入窗口",WINDOW_FREERATIO);
//imshow("输入窗口", src2);
QuickDemo qd;
//qd.colorSpace_Demo(src);//颜色空间转换
//qd.mat_Creation_demo(src);//创建空白图像
//qd.pixel_visit_demo(src);//像素查看
//qd.operators_demo(src);//图片加减数值
//qd.testsubt(src0, src1);//测试有无雾图片加减
//qd.tracking_bar_demo(src);//拖动条响应
//qd.keyboard_demo(src);//键盘响应
//qd.color_style_demo(src);//颜色类型操作
//qd.bitwise_demo(src); //位操作
//qd.channels_demo(src);//通道合并与拆分
//qd.inrange_demo(src2);//图像色彩空间转换,抠图,换背景等
//qd.pixel_statistic_demo(src); //图像像素值统计 均值 方差
//qd.drawing_demo(src); // 绘制随机数 与 随机颜色
//qd.random_drawing(); // 绘制随机数 与 随机颜色
//qd.polyline_drawing_demo(); // 用ploylines绘制多边形 并用 函数fillpoly填充
//qd.mouse_drawing_demo(src);// 鼠标响应绘制多边形
//qd.norm_demo(src2);//归一化
//qd.resize_demo(src);//放缩resize
//qd.flip_demo(src);//镜像
//qd.rotate_demo(src);//旋转
//qd.showHistogram(src2); //直方图
//qd.histogram_2d_demo(src);//2d直方图
//qd.histogram_eq_demo(src); //直方图均衡
//qd.blur_demo(src); //均值卷积 模糊
//qd.gaussian_blur_demo(src); //高斯模糊
//qd.bifilter_demo(src); //双边模糊 保留边缘,去掉噪声
qd.face_detect(); //人脸检测
waitKey(0);
destroyAllWindows();
return 0;
}