Automatic image enhancement by learning adaptive patch selection