A comparative study of thinning algorithms in pattern processing