Found bug where the sort order would incorporate the lowest N rewards, instead of the highest. With this fix, one can now use fewer best directions instead.
px is an 1D array, and cause a runtime error when trying to strip the color channels into RGB. I fixed this by first reshape the px array into am image compatible format first.