一 学习内容
1 拉普拉斯算子(二阶导数)用于边缘检测
二 代码调试
#include <opencv2/opencv.hpp>
#include <iostream>
#include <math.h>
using namespace cv;
int main() {
Mat src, dst_blur, dst_gray,dst_Laplace,dst_Thresh;
src = imread("e:/2 opencv_projects_zl/desk2.jpg");
if (!src.data) {
printf("Load Error...\n");
return -1;
}
namedWindow("Figure1",CV_WINDOW_AUTOSIZE);
imshow("Figure1",src);
//学习新内容:拉普拉斯算子求二阶导数(边缘)
char Figure2_blur[] = "Figure2_blur";
char Figure3_gray[] = "Figure3_gray";
char Figure4_Laplace[] = "Figure4_Laplace";
char Figure5_Thresh[] = "Figure5_Thresh";
//1. 高斯模糊
GaussianBlur(src,dst_blur,Size(3,3),0,0);
namedWindow(Figure2_blur, CV_WINDOW_AUTOSIZE);
imshow(Figure2_blur, dst_blur);
//2.转灰度图像
cvtColor(dst_blur, dst_gray,CV_BGR2GRAY);
namedWindow(Figure3_gray, CV_WI