matlab-bgl implementation of components detection