Uniform map of R3 colour space onto a discrete number line












0












$begingroup$


I'm thinking about theoretical colour palette formation.



I have to start with a locus of $1000^3$ points in $R^3$, with each colour component axis being a discrete variable $0 le r, g, b < 1000$. (The resolution of 1000 is due to software constraints). This represents an RGB colour space - the cubic solid shown in the lower left of this diagram:



color solids



I have to decide on a scheme to choose up to $2^8$ of those points in a manner that attempts to get approximate uniform representation from each axis, and then map those points to an $R^1$ discrete space $0 le p < 2^8$. The mapping doesn't need to be linear but that would make things easier.



Uniform method



If we choose $n$ values on each axis, then



$n = lfloor 2^{8/3} rfloor = 6$ values per axis



$6^3 = 216$ values



$ frac {100 cdot 6^3} {2^8} approx 84% $ p space usage



For each channel value $c_i$, for $0 le i < 3$,



$c_i = frac {1000} 6 modleft( lfloor frac p {6^i} rfloor, 6 right) $



That method has perfect channel uniformity but wastes a lot (16%) of the p space.



The following is a generated visual representation of the uniform palette. The x-axis is red, the "short" y-axis is green, and the "long" y-axis is blue.



uniform-palette



Bitfield method



Another method is to divide the colour channels into bit fields: for field bit count $f_i, 0 le i < 3$:



$sum_i f_i = 8$



$f = (3, 3, 2)$



$c_i = frac {1000} {f_i} modleft( lfloor frac p {f_{i-1}^i} rfloor, f_i right) $



$f_{i-1} = 1$ for $i = 0$.



This method has perfect p space usage but poor uniformity. Two of the channels have $2^3=8$ values per axis but the last only has $2^2=4$ values.



The following is a generated visual representation of the bitfield palette, with the same axes as the previous one.



uniform palette



I'd like to learn of another method to map p to the $R^3$ space that achieves better uniformity than the bit field method while still using all of the p space.










share|cite|improve this question











$endgroup$

















    0












    $begingroup$


    I'm thinking about theoretical colour palette formation.



    I have to start with a locus of $1000^3$ points in $R^3$, with each colour component axis being a discrete variable $0 le r, g, b < 1000$. (The resolution of 1000 is due to software constraints). This represents an RGB colour space - the cubic solid shown in the lower left of this diagram:



    color solids



    I have to decide on a scheme to choose up to $2^8$ of those points in a manner that attempts to get approximate uniform representation from each axis, and then map those points to an $R^1$ discrete space $0 le p < 2^8$. The mapping doesn't need to be linear but that would make things easier.



    Uniform method



    If we choose $n$ values on each axis, then



    $n = lfloor 2^{8/3} rfloor = 6$ values per axis



    $6^3 = 216$ values



    $ frac {100 cdot 6^3} {2^8} approx 84% $ p space usage



    For each channel value $c_i$, for $0 le i < 3$,



    $c_i = frac {1000} 6 modleft( lfloor frac p {6^i} rfloor, 6 right) $



    That method has perfect channel uniformity but wastes a lot (16%) of the p space.



    The following is a generated visual representation of the uniform palette. The x-axis is red, the "short" y-axis is green, and the "long" y-axis is blue.



    uniform-palette



    Bitfield method



    Another method is to divide the colour channels into bit fields: for field bit count $f_i, 0 le i < 3$:



    $sum_i f_i = 8$



    $f = (3, 3, 2)$



    $c_i = frac {1000} {f_i} modleft( lfloor frac p {f_{i-1}^i} rfloor, f_i right) $



    $f_{i-1} = 1$ for $i = 0$.



    This method has perfect p space usage but poor uniformity. Two of the channels have $2^3=8$ values per axis but the last only has $2^2=4$ values.



    The following is a generated visual representation of the bitfield palette, with the same axes as the previous one.



    uniform palette



    I'd like to learn of another method to map p to the $R^3$ space that achieves better uniformity than the bit field method while still using all of the p space.










    share|cite|improve this question











    $endgroup$















      0












      0








      0





      $begingroup$


      I'm thinking about theoretical colour palette formation.



      I have to start with a locus of $1000^3$ points in $R^3$, with each colour component axis being a discrete variable $0 le r, g, b < 1000$. (The resolution of 1000 is due to software constraints). This represents an RGB colour space - the cubic solid shown in the lower left of this diagram:



      color solids



      I have to decide on a scheme to choose up to $2^8$ of those points in a manner that attempts to get approximate uniform representation from each axis, and then map those points to an $R^1$ discrete space $0 le p < 2^8$. The mapping doesn't need to be linear but that would make things easier.



      Uniform method



      If we choose $n$ values on each axis, then



      $n = lfloor 2^{8/3} rfloor = 6$ values per axis



      $6^3 = 216$ values



      $ frac {100 cdot 6^3} {2^8} approx 84% $ p space usage



      For each channel value $c_i$, for $0 le i < 3$,



      $c_i = frac {1000} 6 modleft( lfloor frac p {6^i} rfloor, 6 right) $



      That method has perfect channel uniformity but wastes a lot (16%) of the p space.



      The following is a generated visual representation of the uniform palette. The x-axis is red, the "short" y-axis is green, and the "long" y-axis is blue.



      uniform-palette



      Bitfield method



      Another method is to divide the colour channels into bit fields: for field bit count $f_i, 0 le i < 3$:



      $sum_i f_i = 8$



      $f = (3, 3, 2)$



      $c_i = frac {1000} {f_i} modleft( lfloor frac p {f_{i-1}^i} rfloor, f_i right) $



      $f_{i-1} = 1$ for $i = 0$.



      This method has perfect p space usage but poor uniformity. Two of the channels have $2^3=8$ values per axis but the last only has $2^2=4$ values.



      The following is a generated visual representation of the bitfield palette, with the same axes as the previous one.



      uniform palette



      I'd like to learn of another method to map p to the $R^3$ space that achieves better uniformity than the bit field method while still using all of the p space.










      share|cite|improve this question











      $endgroup$




      I'm thinking about theoretical colour palette formation.



      I have to start with a locus of $1000^3$ points in $R^3$, with each colour component axis being a discrete variable $0 le r, g, b < 1000$. (The resolution of 1000 is due to software constraints). This represents an RGB colour space - the cubic solid shown in the lower left of this diagram:



      color solids



      I have to decide on a scheme to choose up to $2^8$ of those points in a manner that attempts to get approximate uniform representation from each axis, and then map those points to an $R^1$ discrete space $0 le p < 2^8$. The mapping doesn't need to be linear but that would make things easier.



      Uniform method



      If we choose $n$ values on each axis, then



      $n = lfloor 2^{8/3} rfloor = 6$ values per axis



      $6^3 = 216$ values



      $ frac {100 cdot 6^3} {2^8} approx 84% $ p space usage



      For each channel value $c_i$, for $0 le i < 3$,



      $c_i = frac {1000} 6 modleft( lfloor frac p {6^i} rfloor, 6 right) $



      That method has perfect channel uniformity but wastes a lot (16%) of the p space.



      The following is a generated visual representation of the uniform palette. The x-axis is red, the "short" y-axis is green, and the "long" y-axis is blue.



      uniform-palette



      Bitfield method



      Another method is to divide the colour channels into bit fields: for field bit count $f_i, 0 le i < 3$:



      $sum_i f_i = 8$



      $f = (3, 3, 2)$



      $c_i = frac {1000} {f_i} modleft( lfloor frac p {f_{i-1}^i} rfloor, f_i right) $



      $f_{i-1} = 1$ for $i = 0$.



      This method has perfect p space usage but poor uniformity. Two of the channels have $2^3=8$ values per axis but the last only has $2^2=4$ values.



      The following is a generated visual representation of the bitfield palette, with the same axes as the previous one.



      uniform palette



      I'd like to learn of another method to map p to the $R^3$ space that achieves better uniformity than the bit field method while still using all of the p space.







      computer-science closed-map






      share|cite|improve this question















      share|cite|improve this question













      share|cite|improve this question




      share|cite|improve this question








      edited Jan 2 at 23:05







      Reinderien

















      asked Jan 2 at 22:47









      ReinderienReinderien

      1135




      1135






















          1 Answer
          1






          active

          oldest

          votes


















          1












          $begingroup$

          6*6*7 = 252, which is much closer to 256. If $R in [0, 6)$, $G in [0, 7)$, and $B in [0, 6)$, the 8-bit indexed colour could be



          $C = R*7*6 + G*6 + B$



          That's pretty good.



          I also tried a spherical packing. For a face-centred packing into a cube with points at all corners, I get that a pattern $2x + 1$ layers deep has $4x^3 + 6x^2 + 3x + 1$ points in it. When $x = 3$, the pattern has 172 points. When $x = 4$, the pattern has 365 points. So neither of those is any good... On the other hand, I just found a totally awesome way of visually representing non-leap-years.






          share|cite|improve this answer









          $endgroup$













          • $begingroup$
            6,7,6 yields about 1.6% waste. Awesome!
            $endgroup$
            – Reinderien
            Jan 3 at 4:17











          Your Answer





          StackExchange.ifUsing("editor", function () {
          return StackExchange.using("mathjaxEditing", function () {
          StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix) {
          StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["$", "$"], ["\\(","\\)"]]);
          });
          });
          }, "mathjax-editing");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "69"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          noCode: true, onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f3060066%2funiform-map-of-r3-colour-space-onto-a-discrete-number-line%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          1












          $begingroup$

          6*6*7 = 252, which is much closer to 256. If $R in [0, 6)$, $G in [0, 7)$, and $B in [0, 6)$, the 8-bit indexed colour could be



          $C = R*7*6 + G*6 + B$



          That's pretty good.



          I also tried a spherical packing. For a face-centred packing into a cube with points at all corners, I get that a pattern $2x + 1$ layers deep has $4x^3 + 6x^2 + 3x + 1$ points in it. When $x = 3$, the pattern has 172 points. When $x = 4$, the pattern has 365 points. So neither of those is any good... On the other hand, I just found a totally awesome way of visually representing non-leap-years.






          share|cite|improve this answer









          $endgroup$













          • $begingroup$
            6,7,6 yields about 1.6% waste. Awesome!
            $endgroup$
            – Reinderien
            Jan 3 at 4:17
















          1












          $begingroup$

          6*6*7 = 252, which is much closer to 256. If $R in [0, 6)$, $G in [0, 7)$, and $B in [0, 6)$, the 8-bit indexed colour could be



          $C = R*7*6 + G*6 + B$



          That's pretty good.



          I also tried a spherical packing. For a face-centred packing into a cube with points at all corners, I get that a pattern $2x + 1$ layers deep has $4x^3 + 6x^2 + 3x + 1$ points in it. When $x = 3$, the pattern has 172 points. When $x = 4$, the pattern has 365 points. So neither of those is any good... On the other hand, I just found a totally awesome way of visually representing non-leap-years.






          share|cite|improve this answer









          $endgroup$













          • $begingroup$
            6,7,6 yields about 1.6% waste. Awesome!
            $endgroup$
            – Reinderien
            Jan 3 at 4:17














          1












          1








          1





          $begingroup$

          6*6*7 = 252, which is much closer to 256. If $R in [0, 6)$, $G in [0, 7)$, and $B in [0, 6)$, the 8-bit indexed colour could be



          $C = R*7*6 + G*6 + B$



          That's pretty good.



          I also tried a spherical packing. For a face-centred packing into a cube with points at all corners, I get that a pattern $2x + 1$ layers deep has $4x^3 + 6x^2 + 3x + 1$ points in it. When $x = 3$, the pattern has 172 points. When $x = 4$, the pattern has 365 points. So neither of those is any good... On the other hand, I just found a totally awesome way of visually representing non-leap-years.






          share|cite|improve this answer









          $endgroup$



          6*6*7 = 252, which is much closer to 256. If $R in [0, 6)$, $G in [0, 7)$, and $B in [0, 6)$, the 8-bit indexed colour could be



          $C = R*7*6 + G*6 + B$



          That's pretty good.



          I also tried a spherical packing. For a face-centred packing into a cube with points at all corners, I get that a pattern $2x + 1$ layers deep has $4x^3 + 6x^2 + 3x + 1$ points in it. When $x = 3$, the pattern has 172 points. When $x = 4$, the pattern has 365 points. So neither of those is any good... On the other hand, I just found a totally awesome way of visually representing non-leap-years.







          share|cite|improve this answer












          share|cite|improve this answer



          share|cite|improve this answer










          answered Jan 3 at 3:58









          enigmaticPhysicistenigmaticPhysicist

          1985




          1985












          • $begingroup$
            6,7,6 yields about 1.6% waste. Awesome!
            $endgroup$
            – Reinderien
            Jan 3 at 4:17


















          • $begingroup$
            6,7,6 yields about 1.6% waste. Awesome!
            $endgroup$
            – Reinderien
            Jan 3 at 4:17
















          $begingroup$
          6,7,6 yields about 1.6% waste. Awesome!
          $endgroup$
          – Reinderien
          Jan 3 at 4:17




          $begingroup$
          6,7,6 yields about 1.6% waste. Awesome!
          $endgroup$
          – Reinderien
          Jan 3 at 4:17


















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Mathematics Stack Exchange!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          Use MathJax to format equations. MathJax reference.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f3060066%2funiform-map-of-r3-colour-space-onto-a-discrete-number-line%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          'app-layout' is not a known element: how to share Component with different Modules

          android studio warns about leanback feature tag usage required on manifest while using Unity exported app?

          WPF add header to Image with URL pettitions [duplicate]