zoukankan      html  css  js  c++  java
  • 图像边缘检测 拉普拉斯算子

    #include <opencv2/opencv.hpp>
    #include <iostream>
    #include <math.h>
    using namespace cv;
    using namespace std;
    
    Mat src, dst,dst2,gray_src;
    char* INPUT_WIN = "input image";
    char* OUTPUT_WIN = "binary image";
    int threshold_value = 127;
    int threshold_max = 255;
    int type_value = 2;
    int type_max = 4;
    
    
    int main()
    {
    
        src = imread(".//pic//kate.png");
    
        namedWindow(INPUT_WIN, CV_WINDOW_AUTOSIZE);
        namedWindow(OUTPUT_WIN, CV_WINDOW_AUTOSIZE);
        imshow(INPUT_WIN, src);
        
        Mat gray_src, edge_image;
        GaussianBlur(src, dst, Size(3, 3), 0, 0);
        cvtColor(dst, gray_src, CV_BGR2GRAY);
    
        Laplacian(gray_src, edge_image, CV_16S, 3);
        convertScaleAbs(edge_image, edge_image);
    
        threshold(edge_image, edge_image, 0, 255, THRESH_OTSU | THRESH_BINARY);
         
        imshow(OUTPUT_WIN, edge_image);
    
        waitKey(0);
        return 0; 
    }
  • 相关阅读:
    加载中动画
    跑步动画
    关键帧动画
    animate.css
    怪异盒子
    弹性项目属性
    改变元素大小
    Linux 文件系统 --磁盘I/O
    Linux 文件系统
    Sample Test Strategy
  • 原文地址:https://www.cnblogs.com/xiaochi/p/12010671.html
Copyright © 2011-2022 走看看