ntours and taking the first nearest segment.</p>
<p>To prevent segments from being visited twice, each segment is marked as visited upon traversal.</p>
<p>This process continues until the contour is complete, forming either an <span style="color:#ff3333ff;"><strong>outer</strong></span> or <span style="color:#1a8effff;"><strong>inner</strong></span> contour.</p>
<p>By following this approach, <span style="color:#ff3333ff;"><strong>outer</strong></span> contours are extracted in a counter-clockwise direction