From Moving Objects Detection to Classification and Recognition: A Review for Smart Environments