The solution considers “extraction of boundary edges” first and then traverses along the boundaries to get the exact boundary profile (contour) as opposed to existing algorithms based on points and ray tracing algorithms.