I want to find the contours of (parts) image and sent the output to a laser cutter. For example, take this image:
I use this code:
maskv1 = AlphaChannel[RemoveBackground[bal1]]; contours = ImageMeasurements[ EdgeDetect[Blur[ImageMultiply[bal1, maskv1], 2], 1], "Contours"]; bal4 = ImageGraphics[ ColorNegate[ DeleteSmallComponents[ Dilation[ EdgeDetect[BilateralFilter[Graphics[contours], 7, .1]], .6], Method -> "Mean"]], ImageSize -> 600]; The output is:
The red line is done by myself. As you can see, the contour is not closed. The desired output is something like:
So I need a function to close the outline/contour. Who has a suggestion to do this?



