Page 1 of 1

CannyEdge Auto threshold?

Posted: Thu May 23, 2019 3:57 am
by fsikkerm
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 :

Code: Select all

    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

Re: CannyEdge Auto threshold?

Posted: Thu May 23, 2019 10:27 am
by kwagyeman
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.

Re: CannyEdge Auto threshold?

Posted: Thu May 23, 2019 2:17 pm
by fsikkerm
Hi

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