a basic image correlation algorithm