opencv canny边缘检测

void cannyImg()
{
    //载入原始图  
    Mat srcImage = imread("1.jpg");
    imshow("原图", srcImage);

    Mat edge;

    //转为灰度图像
    cvtColor(srcImage, edge, COLOR_BGR2GRAY);

    //滤波降噪
    blur(edge, edge, Size(3, 3));

    //Canny边缘检测
    Canny(edge, edge, 3, 9, 3);

    //显示效果图 
    imshow("效果图", edge);

    waitKey(0);

    return ;
}

你可能感兴趣的:(#,opencv)