CannyEdge Auto threshold?

Hi All,

For my project the routine looks at various images having text and/or pictures.
These can be white on light background but also black on a darkgreen background ( any many more variations )
I have seen some samples of auto thresholding but they don’t translate 1 on 1 to openmv .

For now I use :

    v=img.get_statistics().l_median()
    lower = int( v/7)  # Value 7 is based on trying as is 2.5 )
    upper = int( v/2.5)
    print(v,upper,lower)
    edgethreshold= (lower, upper)
    img.find_edges(image.EDGE_CANNY, threshold=edgethreshold)

It seems to do the job quit nice but I wonder if there is a better way ?

Thx

Hi, if you don’t need canny all the mean/median/mode/midpoint filters accept adaptive thresholding arguments. These will allow you to find the edges of images using a filters. Morph accepts adaptive thresholding arguments too.

Hi

Thx
Canny edge gives me the best and fastest results…
I had tried morph. :smiley: