Synced python and c++ code for border_removal.