How to choose thresold values for edge detection in openCV?
My application is to detect coins. I have done most of it using OpenCv . Am using CannyDetection and houghTransform to detect circles开发者_Go百科 of image.
But am not getting right circles of coins, I think it might be problem with ThresoldValues passing to cannyEdgeDetector. Can any one tell me how to choose thresold values for detecting circles of coins.
Thanking u, Srinivas
If you would post an image of your problem it would be easier to answer. One idea though is to a circular Hough transform on the contours output by cannyEdgeDetector. This would reduce the sensitivity on a bad threshold.
For choosing thresholds , a lot of things needs to be cosidered ..
Firstly Canny Uses two Thresholds for hysteris and Nonmaxima Suppression, one low threshold and one high threshold. Its generally preferred that high threshold is chosen to be double of low threshold .
Lower Threshold -- Edges having Magnitude less than that will be suppressed
Higher Threshhold -- Edges having Magnitude greater than will be retained
and Edges between Low and High will be retained only if if lies/connects to a high thresholded edge point.
Choice of High and low thresholds depends totally upon your edge strength. If you have coins having bright boundaries you could choose 80 and 160 But if the coin edges are having low strength then values like 30-50 for low threshold and 60-100 for high threshold would suffice,
One more thing i would like to add that if you choose low threshold some extra unwanted edges will also come but if your coins edge's strength are of that magnitude then you are forced to choose lower thresholds.
精彩评论