private void toHSL_Click(object sender, EventArgs e)
        {
            for (int x = 0; x < imgOrig.Width; x++)
            {
                for (int y = 0; y < imgOrig.Height; y++)
                {
                    ColorToHSL(imgOrig.GetPixel(x, y), out h, out s, out l);

                    res1.SetPixel(x, y, HSLToColor(h, 1, 0.5));
                    res2.SetPixel(x, y, HSLToColor(h, s, 0.5));
                    res3.SetPixel(x, y, HSLToColor(h, 1, l));
                }
            }

            cm1 = new ColorModels("H", res1, 3);
            cm1.Show();
            cm2 = new ColorModels("S", res2, 3);
            cm2.Show();
            cm3 = new ColorModels("L", res3, 3);
            cm3.Show();
        }
        private void toRGB_Click(object sender, EventArgs e)
        {
            for (int x = 0; x < imgOrig.Width; x++)
            {
                for (int y = 0; y < imgOrig.Height; y++)
                {
                    res1.SetPixel(x, y, Color.FromArgb(imgOrig.GetPixel(x, y).R, 0, 0));
                    res2.SetPixel(x, y, Color.FromArgb(0, imgOrig.GetPixel(x, y).G, 0));
                    res3.SetPixel(x, y, Color.FromArgb(0, 0, imgOrig.GetPixel(x, y).B));

                    int grayscale = (int)((imgOrig.GetPixel(x, y).R * 0.299) + (imgOrig.GetPixel(x, y).G * 0.587) + (imgOrig.GetPixel(x, y).B * 0.114));
                    res4.SetPixel(x, y, Color.FromArgb(grayscale, grayscale, grayscale));
                }
            }
            cm1 = new ColorModels("R", res1, 0);
            cm1.Show();
            cm2 = new ColorModels("G", res2, 0);
            cm2.Show();
            cm3 = new ColorModels("B", res3, 0);
            cm3.Show();
            cm4 = new ColorModels("GrayScale", res4, 0);
            cm4.Show();
        }
        private void toYUV_Click(object sender, EventArgs e)
        {
            for (int x = 0; x < imgOrig.Width; x++)
            {
                for (int y = 0; y < imgOrig.Height; y++)
                {
                    ColorToYUV(imgOrig.GetPixel(x, y), out Y, out u, out v);

                    res1.SetPixel(x, y, YUVToColor(Y, 128, 128));
                    res2.SetPixel(x, y, YUVToColor(128, u, 128));
                    res3.SetPixel(x, y, YUVToColor(128, 128, v));
                    res4.SetPixel(x, y, Color.FromArgb(TrimRGB(Y), TrimRGB(u), TrimRGB(v)));
                }
            }

            cm1 = new ColorModels("Y", res1, 2);
            cm1.Show();
            cm2 = new ColorModels("U", res2, 2);
            cm2.Show();
            cm3 = new ColorModels("V", res3, 2);
            cm3.Show();
            cm4 = new ColorModels("YUV", res4, 2);
            cm4.Show();
        }