Two-stage weighted centroid localization for large-scale wireless sensor networks in ambient intelligence environment