hbiz
asked on
Non uniform 2d grid subdivision based on gradient map
Given a black and white gradient map where pure black is 0.0 and pure white is 1.0. I'd like to generate coordinates for a 2d grid that has squares of varying sizes such that areas on the map that are whiter generate smaller squares and areas that are blacker generate squares of larger size. These squares will vary between min_size and max_size depending on the color of the map.
Perhaps this diagram could help explain what I'm trying to achieve:
nonuniform-subdivision.jpg
Perhaps this diagram could help explain what I'm trying to achieve:
nonuniform-subdivision.jpg
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks! this is brilliant!
Draw a grid of max_size over the whole image. Then iterate through each grid square. Take the average (or max, your choice) color of the square. If it is above the threshold (current_size_index/num_si
The whole thing will just be one simple recursive function.