Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6686271
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T05:09:10+00:00 2026-05-26T05:09:10+00:00

need some help with this one. I have some reflectance values for a colour

  • 0

need some help with this one. I have some reflectance values for a colour and need to convert these to L* a* b* C* h values.

I have found some visual basic source that claims to do this but I have no knowledge of visual basic to convert it into C sharp.

Anyone able to help?

http://www.vbforums.com/showthread.php?p=821074

Sample Data
Reflectance Values : 0.35380, 0.44130, 0.50230, 0.51650, 0.52210, 0.52780, 0.53110, 0.53350, 0.53630, 0.53900, 0.54130, 0.54330, 0.54500, 0.54630, 0.54690, 0.54680, 0.54640, 0.54710, 0.54940, 0.55240, 0.55330, 0.55250, 0.55200, 0.55190, 0.55220, 0.55310, 0.55260, 0.55340, 0.55500, 0.55540, 0.55400

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T05:09:10+00:00Added an answer on May 26, 2026 at 5:09 am

    I have managed to answer my own question!

    double[] d65Vals_X = new double[31] { 0.137, 0.676, 1.603, 2.451, 3.418, 3.699, 3.064, 1.933, 0.802, 0.156, 0.039, 0.347, 1.070, 2.170, 3.397, 4.732, 6.070, 7.311, 8.291, 8.634, 8.672, 7.930, 6.446, 4.669, 3.095, 1.859, 1.056, 0.570, 0.274, .0121, 0.058 };
            double[] d65Vals_Y = new double[31] { 0.014, 0.069, 0.168, 0.300, 0.554, 0.890, 1.290, 1.838, 2.520, 3.226, 4.320, 5.621, 6.907, 8.059, 8.668, 8.855, 8.581, 7.951, 7.106, 6.004, 5.079, 4.065, 2.999, 2.042, 1.290, 0.746, 0.417, 0.223, 0.107, 0.047, 0.023 };
            double[] d65Vals_Z = new double[31] { 0.612, 3.110, 7.627, 12.095, 17.537, 19.888, 17.695, 13.000, 7.699, 3.938, 2.046, 1.049, 0.544, 0.278, 0.122, 0.035, 0.001, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000 };
    
            private double FXYZ(double[] REF, int A){
                double XYZref = 0;
                double illXYZ = 0;
                int i;
    
                for (i = 0; i < 31; i++)
                {
                    if (A == 0){
                        XYZref = XYZref + (REF[i] * d65Vals_X[i]);
                        illXYZ = illXYZ + d65Vals_X[i];
                    } else if (A == 1){
                        XYZref = XYZref + (REF[i] * d65Vals_Y[i]);
                        illXYZ = illXYZ + d65Vals_Y[i];
                    } else {
                        XYZref = XYZref + (REF[i] * d65Vals_Z[i]);
                        illXYZ = illXYZ + d65Vals_Z[i];
                    }                
                }
                return (XYZref / (100 * illXYZ));
            }
            private void btnCalculate_Click(object sender, EventArgs e)
            {
                int i;
    
                double L, A, B;
    
                double[] reflexVals = new double[31];
                Console.Write("Reflex Data: ");
                for (i = 0; i < 31; i++)
                {
                    TextBox reflex = this.Controls["txtReflex_" + (i + 1)] as TextBox;                
                    reflexVals[i] = double.Parse(reflex.Text);
                    Console.Write(reflexVals[i].ToString() + ", ");
                }
                Console.Write("\n");
    
                double[] FFXYZ = new double[3];
                double[] XYZ = new double[3];
                double CR = (1 / 3);
                CR = 0.33333333333333333333333333333333;
                for (i = 0; i < 3; i++)
                {
                    XYZ[i] = FXYZ(reflexVals, i);
                    Console.WriteLine("XYZ[" + i + "] = " + XYZ[i]);
                    if (XYZ[i] > 0.008856)
                    {
    
                        FFXYZ[i] = Math.Pow(XYZ[i], CR);
                        Console.WriteLine("FFXYZ[" + i + "] = " + Math.Pow(XYZ[i], CR));
                    }
                    else
                    {
                        FFXYZ[i] = (7.787 * XYZ[i]) + (16 / 116);
                        Console.WriteLine("FFXYZ[" + i + "] = (7.787 * " + XYZ[i] + ") + (16 / 116)");
                    }
                }
    
                if (XYZ[1] > 0.00856)
                {
                    L = (116 * FFXYZ[1]) - 16;
                    Console.WriteLine("L = (116 * " + FFXYZ[1] + ") - 16");
                }
                else
                {
                    L = 903.3 * XYZ[1];
                    Console.WriteLine("L = 903.3 * " + XYZ[1] + ")");
                }
    
                A = 500 * (FFXYZ[0] - FFXYZ[1]);
                B = 200 * (FFXYZ[1] - FFXYZ[2]);
    
                Console.WriteLine("A = 500 * (" + FFXYZ[0] + " - " + FFXYZ[1] + ")");
                Console.WriteLine("A = 200 * (" + FFXYZ[1] + " - " + FFXYZ[2] + ")");
    
                txtCalcL.Text = L.ToString();
                txtCalcA.Text = A.ToString();
                txtCalcB.Text = B.ToString();
            }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need some help with this one.... I have this simple model: public class
Okay, I am stumped on this one and need some quick help. I have
I need some help on this one please, i basically have menuVIP.java, and vipKeyword.java.
Hi i need some help on this. I have one web server and i
I really need some help with this as I have been trying to fix
Need some help to solve this. I have a gridview and inside the gridview
I need some help in solving this problem. We have a large amount of
I have one jQuery code and need some help from u guys to improve
I need some help regarding Visual Studio solution and project organization. I have a
I need some help about xsl. I have a date attribute in source xml

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.