Click to See Complete Forum and Search --> : Forcing clumped 2D data into the best uniformly distributed grid


thorpie
September 1st, 2010, 09:06 PM
Hello
Could anyone point me in the direction of code/algorithms/papers on forcing clumped 2D data into the best uniformly distributed grid.
For instance I have 4,096 data-points which each contain an x value and a y value. There may be duplicate data-points, and the values will not necessarily be restricted to a maximum of 64. I want to allocate the data-points to a 64 * 64 grid, with each data-point mapping to one grid point, so the 64 by 64 grid is filled.
I presume this is not an unusual field and that it is mostly a terminology problem, however I have been unsuccessful searching for many terms including forcing/mapping uniform/even distribution/dispersion nearest neighbour.
Thanks

Zachm
September 1st, 2010, 11:05 PM
Hello
I want to allocate the data-points to a 64 * 64 grid, with each data-point mapping to one grid point, so the 64 by 64 grid is filled.
Why ?
What is the requirement from this 64x64 grid mapping ?
What does it help you achieve ?

You wrote what you want to do "allocate each data point to a grid point so the grid is filled" - but you didn't mention what this allocation supposed to do - does ordering between data points matter when it comes to the grid assignment ?
Once this assignment is done, what will you do with it ?

Without the answer to the questions I raised, I don't think one could give a solution to your problem.

Regards,
Zachm

thorpie
September 2nd, 2010, 09:09 AM
Thanks for getting back Zachm
What I actually need is a 3D solution for colors, up to a 255 * 255 * 255 grid. I gave the 64 * 64 2D grid as a smaller example.
I am generating pipapic images from existing pictures. Pipapics are images that have each pixel uniquely colored with colors from an evenly spaced palette. So a 4,096 * 4,096 pipapic has each of the 16,777,216 colors in the rgb colorspace used for a single pixel. As the only evenly spaced palettes extractable from the rgb colorspace are dependent upon the factors of 255 (ie 1,3,5,15,17,51,85 & 255) there are only a limited number of canvas sizes for pipapics.
I have tried a number of techniques to convert existing images, and was initially of the opinion that there were unlimited options for the conversion, and it was personal preference or artistic merit that would determine what was preferable. However on reflection I realise that some techniques will be “more equal than others” and that the most equal will be those developed for robust scientific application.
Techniques I have coded or tried include moving duplicates to closest vacant (not good as order is lost), sorting and initially allocating on luminosity, then distributing on luminosity surfaces (not good as large clumps take over a full luminosity surface), shaking, or sorting from each combination of corner to corner (luminosity, then red to cyan, green to magenta and blue to yellow) and side to side (has similar problems to initial luminosity sort, and the clumps do not separate, they seem to converge and get clumpier rather then diverging) and recursive sub-cubes or splitting on median values into 8 sub-cubes, then each of these into 8 yet smaller cubes.
The major requirement is that loss of order (in 3D space) is minimized. The recursive cube seems best, however this is what I call indefensible. If I split on the red median value first, then on the green median in each half, I get a different result to if I split on the green first and then on the red.
As I said, I presume this matter has been extensively studied, and I think I primarily need the right terminology to identify relevant literature.
Any advice appreciated.
Thanks