How to get button border size?

asked 2019-03-03 20:27:37 -0500

I'm a beginner using opencv. I'm trying to get the border size of a button. I've tried canny but that only gives me the outer edge of the button. I don't know how to get the inner one to compute the difference in distance. Any help is appreciated.

image description

edit retag flag offensive close merge delete

Comments

Invert or threshold this image, then use findContours to get the outer contour. Using this contour's center and bounding rectangle, set up a liine with lineIterator that starts just beyond the edge and extends inward toward center. As you step along this line, look at the pixel intensities. Take note of when the intensity changes from light to dark and then back to light again.

Chris gravatar imageChris ( 2019-03-04 13:20:42 -0500 )edit