首页 > 其他 > 详细

(21)Laplance

时间:2018-12-29 15:50:05      阅读:179      评论:0      收藏:0      [点我收藏+]

这个算法还是用来进行边缘检测的

===============================

 

 1 #include <opencv2/opencv.hpp>
 2 #include <iostream>
 3 using namespace std;
 4 using namespace cv;
 5 
 6 Mat src, dst, gray_src;
 7 
 8 int main(int agrc, char** agrv) {
 9 
10     src = imread("C:\\Users\\32829\\Desktop\\aa.jpg");
11     if (!src.data) {
12         printf("no load..\n");
13         return -1;
14     }
15     const char* input_win = "input";
16     const char* out_put = "out_put";
17     namedWindow(input_win, CV_WINDOW_AUTOSIZE);
18     namedWindow(out_put, CV_WINDOW_AUTOSIZE);
19     imshow(input_win, src);
20     GaussianBlur(src, dst, Size(3, 3), 0, 0);
21     cvtColor(dst, gray_src, CV_BGR2GRAY);
22     Mat edge_image;
23     Laplacian(gray_src, edge_image, CV_16S, 3);
24     convertScaleAbs(edge_image, edge_image);
25     threshold(edge_image, edge_image, 0, 255, THRESH_OTSU | THRESH_BINARY);
26     imshow(out_put, edge_image);
27 
28     waitKey(0);
29     return 0;
30 }

 

=============================

技术分享图片

 

(21)Laplance

原文:https://www.cnblogs.com/xiaoyoucai/p/10196225.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!