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 ?