-1

I'm new to coding (use python) and working on line pattern defect detection. I have located all the defect with deep-learning and now want to measure the thickness of the line.orange box are detected defects

I isolated each bounding box and image proccess every defect.

So far these steps what i have done:

  1. OpenCV adaptive threshold

enter image description here

  1. Put mask in the center of "X" referencing to this

enter image description here

  1. and last i use cv2.minAreaRect() and get rectangle width as line thickness

Any sugestion will be appreciated.

  • 1
    Please provide enough code so others can better understand or reproduce the problem. – Community Nov 10 '22 at 17:14
  • Get the medial axis (center line) from your mask. Then get the distance transform of the mask. Then get the values from the distance transform along the medial axis. Each value will be the half thickness (shortest distance from the medial axis to the boundary of your mask) – fmw42 Nov 10 '22 at 20:26

1 Answers1

0

You could use findContours to get the contour of an individual defect and then use contour moments or other contour properties to estimate the line thickness.

Pete
  • 55
  • 5