Uniform map of R3 colour space onto a discrete number line
$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:
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.
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.
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
$endgroup$
add a comment |
$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:
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.
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.
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
$endgroup$
add a comment |
$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:
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.
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.
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
$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:
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.
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.
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
computer-science closed-map
edited Jan 2 at 23:05
Reinderien
asked Jan 2 at 22:47
ReinderienReinderien
1135
1135
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
$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.
$endgroup$
$begingroup$
6,7,6 yields about 1.6% waste. Awesome!
$endgroup$
– Reinderien
Jan 3 at 4:17
add a comment |
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
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
$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.
$endgroup$
$begingroup$
6,7,6 yields about 1.6% waste. Awesome!
$endgroup$
– Reinderien
Jan 3 at 4:17
add a comment |
$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.
$endgroup$
$begingroup$
6,7,6 yields about 1.6% waste. Awesome!
$endgroup$
– Reinderien
Jan 3 at 4:17
add a comment |
$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.
$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.
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
add a comment |
$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
add a comment |
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.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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