简体   繁体   中英

Android: how to get good high and low threshold for canny edge detection using opencv

i am using opencv library for image processing process in android. The problem is when i use canny function for image. This is my code of using canny:

Imgproc.Canny(ImageMat, ImageMat, 0.4, 0.5);

i use low threshold 0.4 and 0.5 for high threshold, but the result for the image is not good. I know i must change the low and high threshold to get the good result, but that must be different threshold for the other image too. How to get dynamic threshold for that canny process?? My project is leaf recognition on android. Sorry for my bad English language.

As far as I know, the only relatively automatic thresholding method may be Otsu operation. You may put more effort on the channel selection and intensity mapping (usually non-linear) instead of thresholding trial. The aim of doing this is to maximize the difference between your object and background, which makes thresholding easier and more robust. In order to achieve this purpose, you may need to check your leaf image database and get a rough idea of the intensity range of leaf and background.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM