Hierarchical tree structure background construction method for motion detection