I have a X, Y coordinate system which starts from 0 and ends in 255 on each axis. Thus, I can fit 65,025 numbers in it. Imagine each number as a pixel, so I have 65,0250 pixels in my coordinate system.
If I pick any random point here, I need to present its X and Y numbers to the computer, so it can detect its position. My problem is that I only have less than 12 bits to save this coordinate number (both X and Y). As you may know, every bit holds only 0s and 1s as integers from 2^0 to 2^8. There are some pixels whose coordinates can be presented in two digits (such as X=55 and Y=30). 55 in binary is equal to 110111 and can be fit in 6 bits, and 30 in binary is equal to 11110 and can be fit in 5 bits. So the coordinates X=55 and Y=30 can be fit into 11 bits altogether.
But the problem is that the majority of pixels (as also visible in the photo) need 3-digit numbers for each X and Y coordinates, thus requiring 16 bits of binary in order to store their positions. For example, the farthest pixel from 0, 0 is the pixel with the coordinates X=255 and Y=255. Each 255 takes 8 bits in binary (11111111), so saving the coordinates of that pixel (and many other pixels) consume 16 bits of binary space. I only have less than 12 bits to do it.
Is there any way to write the position of each pixel in less than 12 bits? I also welcome any ideas about any alternative ways that I can show the position of these pixels (such as polar equations, Archimedean Spiral, Fermat's Spiral, etc.).
I'm stuck here and any help would do great favor to me. Thank you.
Number of pixels with equivalent amounts of bits to save their positions in an X, Y coordinate system.
If you want to hold them all of them it is never possible, 16 bits of pure information cannot be absolutely held in 12 bits.
It can be possible if you accept 12 bits in mean on a huge number of data (it depends on your exact number distribution but if your integers are mainly small it will work) and it is achievable through compression, I encourage you to see Huffman coding.
But in full generality you cannot ensure that every coordinate pair will be held in 12bits. All you can have is 12 bits in mean on a large set of data.