Exemplo n.º 1
0
        //bad, when from file. Lost a lot from converting and round
        public static List <ArraysListInt> Lab2RGB(Bitmap img)
        {
            var labxyz = XYZandLab.Lab2XYZ(img);
            var xyzrgb = RGBandXYZ.XYZ2RGB(labxyz);

            return(xyzrgb);
        }
Exemplo n.º 2
0
        public static List <ArraysListDouble> RGB2Lab(Bitmap img)
        {
            List <ArraysListInt> ColorList = Helpers.GetPixels(img);
            var labResult = new List <ArraysListDouble>();

            var xyz = RGBandXYZ.RGB2XYZ(ColorList);

            labResult = XYZandLab.XYZ2Lab(xyz);

            return(labResult);
        }
Exemplo n.º 3
0
        //R G B arrays in In the following order R G B
        public static List <ArraysListDouble> RGB2Lab(int[,] r, int[,] g, int[,] b)
        {
            List <ArraysListDouble> labResult = new List <ArraysListDouble>();

            if (r.Length != g.Length || r.Length != b.Length)
            {
                Console.WriteLine("R G B arrays size dismatch in rgb2lab operation -> rgb2lab(int[,] R, int[,] G, int[,] B) <-");
            }
            else
            {
                var xyz = RGBandXYZ.RGB2XYZ(r, g, b);
                labResult = XYZandLab.XYZ2Lab(xyz);
            }

            return(labResult);
        }
Exemplo n.º 4
0
        //List with R G B arrays in In the following order R G B
        public static List <ArraysListDouble> RGB2Lab(List <ArraysListInt> rgbList)
        {
            List <ArraysListDouble> labResult = new List <ArraysListDouble>();

            if (rgbList[0].Color.Length != rgbList[1].Color.Length || rgbList[0].Color.Length != rgbList[2].Color.Length)
            {
                Console.WriteLine("list R G B arrays size dismatch in rgb2lab operation -> rgb2lab(List<arraysListInt> rgbList) <-");
            }
            else
            {
                var xyz = RGBandXYZ.RGB2XYZ(rgbList);
                labResult = XYZandLab.XYZ2Lab(xyz);
            }

            return(labResult);
        }
Exemplo n.º 5
0
        //L a b in double values (as after convert XYZ2lab; not in range [0 1])
        //L a b arrays in In the following order L-a-b
        public static List <ArraysListInt> Lab2RGB(double[,] l, double[,] a, double[,] b)
        {
            List <ArraysListInt> rgbResult = new List <ArraysListInt>();

            if (l.Length != a.Length || l.Length != b.Length)
            {
                Console.WriteLine("L a b arrays size dismatch in lab2rgb operation -> lab2rgb(double[,] L, double[,] a, double[,] b) <-");
            }
            else
            {
                List <ArraysListDouble> labxyz = XYZandLab.Lab2XYZ(l, a, b);
                List <ArraysListInt>    xyzrgb = RGBandXYZ.XYZ2RGB(labxyz);

                rgbResult = xyzrgb;
            }

            return(rgbResult);
        }
Exemplo n.º 6
0
        //L a b in double values (as after convert XYZ2lab; not in range [0 1])
        //list L a b arrays in In the following order L-a-b
        public static List <ArraysListInt> Lab2RGB(List <ArraysListDouble> labList)
        {
            List <ArraysListInt> rgbResult = new List <ArraysListInt>();

            if (labList[0].Color.Length != labList[1].Color.Length || labList[0].Color.Length != labList[2].Color.Length)
            {
                Console.WriteLine("L a b arrays size dismatch in lab2rgb operation -> lab2rgb(List<arraysListDouble> labList) <-");
            }
            else
            {
                List <ArraysListDouble> labxyz = XYZandLab.Lab2XYZ(labList);
                List <ArraysListInt>    xyzrgb = RGBandXYZ.XYZ2RGB(labxyz);

                rgbResult = xyzrgb;
            }

            return(rgbResult);
        }