CannyEdge Auto threshold?

OpenMV related project discussion.
fsikkerm
Posts: 12
Joined: Wed Nov 21, 2018 5:21 pm

CannyEdge Auto threshold?

Postby fsikkerm » Thu May 23, 2019 3:57 am

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
User avatar
kwagyeman
Posts: 3829
Joined: Sun May 24, 2015 2:10 pm

Re: CannyEdge Auto threshold?

Postby kwagyeman » Thu May 23, 2019 10:27 am

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.
Nyamekye,
fsikkerm
Posts: 12
Joined: Wed Nov 21, 2018 5:21 pm

Re: CannyEdge Auto threshold?

Postby fsikkerm » Thu May 23, 2019 2:17 pm

Hi

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

Return to “Project Discussion”

Who is online

Users browsing this forum: No registered users and 1 guest