79653862

Date: 2025-06-05 06:06:11
Score: 0.5
Natty:
Report link

Use a colorspace transformation to ease your thresholding operation:

img = cv2.cvtColor(cv2.imread(path), cv2.COLOR_BGR2HSV)[:, :, 2]

Now you can threshold using threshold=127 and get a much better result:

Piece extraction on HSV image

For this example there is barely anything more you can do. I quickly checked with a contouring algorithm and using Bézier curves to smooth the resulting contour, but this does not really improve the result further.

Reasons:
  • Probably link only (1):
  • Has code block (-0.5):
Posted by: André