Like the method used in this /question/270597346.html. The parameter 'thin' then specifies the refinement operation to be performed on the binary image BW, and the parameter inf (infinity) says to keep refining the image until the image no longer changes.