enter image description hereBelow is an image containing road contours. I want to apply skeletonization, but I’m getting poor results. So, I thought of first obtaining the mask from the contours and then applying skeletonization.
How can I do that?
I tried to proprocess the image by :
- Apply Gaussian blur to reduce noise
- Convert to binary image using Otsu’s method
- Apply morphological closing to fill small holes and gaps in the contour
- Create a mask by filling the contours
contour_mask = np.zeros_like(binary_image) contours, _ = cv2.findContours(dilated_image, cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE) for cnt in contours: cv2.drawContours(contour_mask, [cnt], 0, 255, -1)
New contributor
Rania SAOUD is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.