A Learning-based Algorithm for Natural Scene Recognition