You are not logged in.
Pages: 1
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=1232848650
Can this be done ? Impossible maybe ?
Thanks alot of the help !!! *pulling hair*
The co-ordinates for the colour
are given by
By the way, white should be (255,255,255) and black should be (0,0,0); you got them the wrong way round. Also, your co-ordinates for white (255,255,255) are wrong; they should be
Offline
Thanks a lot for the answer JaneFairfax!
If I understand correctly, in a practical way if my pixel is (233, 45, 72):
-26 * 233 = -6058
-50 * 45 = -2250
62 * 72 = 4464
-6058 -2250 +4464 = -3844
-3844 / 255 == -15,07
X == -15,07
-100 * 233 = -23300
76 * 45 = 3420
10 * 72 = 720
-23300 +3420 +720 = -19160
-19160 / 255 == -75,13
Y == -75,13
Am I correct ?
Thank you so much for your time ! I really appreciate.
-fred
Pages: 1