in reply to Re^4: Randomly biased, random numbers. (A working solution)
in thread Randomly biased, random numbers.
Use the color or luminance or hue of the images to weight the picking of 'random' pixels.This is also quite hard to do other than via the rejection method
There is a much more efficient method. See here, and here.
The trick is to build an 1D array with the accumulated weights @acu. Then, pick random numbers ($r) in the range [0, $acu[-1]) and use binary search to look for the index $ix such that $acu[$ix] <= $r <= $acu[$ix + 1].
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^6: Randomly biased, random numbers. (A working solution)
by BrowserUk (Patriarch) on Dec 10, 2013 at 14:32 UTC | |
by salva (Canon) on Dec 10, 2013 at 14:37 UTC | |
by BrowserUk (Patriarch) on Dec 10, 2013 at 14:55 UTC |
In Section
Seekers of Perl Wisdom