Automatic calculation of low and high thresholds for the Canny operation in opencv

后端 未结 7 871
孤独总比滥情好
孤独总比滥情好 2020-11-28 03:15

In openCV, the low and high thresholds for the canny operator are mandatory:

cvCanny(input,output,thresh1,thresh2)

In Matlab, there\'s an o

相关标签:
7条回答
  • 2020-11-28 03:37

    As Luca Del Tongo has suggested, you can calculate the thresholds from the grey image, e.g. in Java using OpenCV...

    MatOfDouble mu = new MatOfDouble();
    MatOfDouble stddev = new MatOfDouble();
    Core.meanStdDev(greyMat, mu, stddev);
    threshold1 = mu.get(0, 0)[0];
    threshold2 = stddev.get(0, 0)[0];
    Imgproc.Canny(greyMat, outputMat, threshold1, threshold2);
    
    0 讨论(0)
提交回复
热议问题