Help triplets to 2d conversion formula

  • Thread starter Thread starter metalfred
  • Start date Start date
  • Tags Tags
    2d Formula
Click For Summary
SUMMARY

The discussion centers on converting RGB pixel colors into 2D XY coordinates using a specific formula. The established formula is (x, y) = R/255 * (-26, -100) + G/255 * (-50, 76) + B/255 * (62, 10). This formula allows for accurate mapping of colors such as red, green, blue, and their combinations to their respective coordinates. The importance of correctly identifying the coordinates for black and white is also emphasized, as they represent the absence and presence of color, respectively.

PREREQUISITES
  • Understanding of RGB color model
  • Basic knowledge of 2D coordinate systems
  • Familiarity with vector mathematics
  • Experience with mathematical formulas and conversions
NEXT STEPS
  • Research the RGB color model and its applications in graphics programming
  • Learn about vector mathematics and its role in coordinate transformations
  • Explore advanced color theory and its implications in digital imaging
  • Investigate other color conversion formulas for different color spaces
USEFUL FOR

Software developers, graphic designers, and anyone involved in color processing or digital imaging who seeks to understand the mathematical conversion of RGB values to 2D coordinates.

metalfred
Messages
2
Reaction score
0
Hi all,

I am learning software development and I need to do something that requires some pretty good mathematics I think. I am not very good and been working to solve this problem for a few days now, any help is appreciated.

Here is what I am doing:


I need to find a way to convert pixel colors (rgb) into a 2d xy coordinates.


I know that the perfect red (255, 0, 0) color is at this position:


rx = -26;
ry = -100;


I know that the perfect green (0, 255, 0) color is at this position:


gx = -50
gy = 76


I know that the perfect blue (0, 0, 255) color is at this position:


bx = 62;
by = 10;


I know that white (0, 0, 0) is at this position:


wx = 0;
wy = 0;


I know that black (255, 255, 255) is at this position:


blx = 0;
bly = 0;


Now I need to figure our the formula to convert something like:

(234, 23, 54) to a X Y position.



This is an image of what I am developing, I have something that works right now but the formula is not right.

Vectorscope:

http://www.codeguru.com/forum/attachment.php?attachmentid=24192&stc=1&d=123284865


Can this be done ? Impossible maybe ?

Thanks a lot of the help ! *pulling hair* :)

-fred
 
Physics news on Phys.org
I have an idea that might be helpful, but first a couple of comments:
I don't see that it's helpful to embed color information in the names of the x and y coordinates; e.g., bx, gx, rx, by, and so on. Just call them x and y.
You show black and white as having the same (x, y) coordinates. Presumably that's a mistake. The color triple for white should be (255, 255, 255) and for black it should be (0, 0, 0). White is the presence of all colors, and black the absence of them all (visible light--pigments are different).

I drew an x,y coordinate system and plotted points for red, green, and blue, namely (-26, -100), (-50, 76), and (62, 10) respectively. These points can be considered the endpoints of vectors that extend from the origin.

The three vectors divide the plane into more-or-less equal thirds.

To convert a color triple (R, G, B) into (x, y) coordinates, you can use this formula:

(x, y) = R/255 *(-26, 100) + G/255 * (-50, 76) + B/255 * (62, 10)

For example, your true blue is (0, 0, 255), so
(x, y) = 0 + 0 + 1 * (62, 10) = (62, 10)

A mix of green and blue is (0, 255, 255), so
(x, y) = 0 + 1 * (-50, 76) + 1 * (62, 10) = (12, 86)

Black (which I'm calling (0, 0, 0)) works out fine, but I don't also get (0, 0) for white.
 
Thanks a lot Mark for your help! I reall appreciate ;)

-fred
 

Similar threads

  • · Replies 6 ·
Replies
6
Views
3K
  • · Replies 7 ·
Replies
7
Views
3K
  • · Replies 5 ·
Replies
5
Views
2K
Replies
4
Views
2K
  • · Replies 3 ·
Replies
3
Views
951
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 36 ·
2
Replies
36
Views
5K