예제 #1
0
        public void getBaseColor()
        {
            Hystogram YH  = new Hystogram(Y);
            Hystogram CrH = new Hystogram(Cr);
            Hystogram CbH = new Hystogram(Cb);

            if (YH.baseColor != -1 && CbH.baseColor != -1 && CrH.baseColor != -1)
            {
                YCrCbPoint n = new YCrCbPoint();
                n.Y       = YH.baseColorByte;
                n.Cr      = CrH.baseColorByte;
                n.Cb      = CbH.baseColorByte;
                baseColor = n;
                isBase    = true;
            }
        }
예제 #2
0
        // создание класса с полным объемом данных используется для копирования
        public YCrCb(byte[] Y_, byte[] Cr_, byte[] Cb_, int len, int width_, int height_, int widthR_, int GridX_, int GridY_, double[,] GridFY_, double[,] GridFCr_, double[,] GridFCb_, YCrCbPoint baseColor_, int[, ,] GridF_m_)
        {
            baseColor = baseColor_;
            width     = width_;
            widthR    = widthR_;
            height    = height_;
            GridX     = GridX_;
            GridY     = GridY_;

            bytes  = len * 3;
            chanel = len;

            R = new byte[chanel];
            G = new byte[chanel];
            B = new byte[chanel];

            Y  = new byte[chanel];
            Cr = new byte[chanel];
            Cb = new byte[chanel];

            for (int i = 0; i < (chanel - 1); i++)
            {
                Y[i]  = Y_[i];
                Cr[i] = Cr_[i];
                Cb[i] = Cb_[i];
            }

            GridFY  = new double[GridX, GridY];
            GridFCr = new double[GridX, GridY];
            GridFCb = new double[GridX, GridY];
            GridF_m = new int[GridX, GridY, 3];

            for (int x = 0; x < GridX; x++)
            {
                for (int y = 0; y < GridY; y++)
                {
                    GridFY[x, y]     = GridFY_[x, y];
                    GridFCr[x, y]    = GridFCr_[x, y];
                    GridFCb[x, y]    = GridFCb_[x, y];
                    GridF_m[x, y, 0] = GridF_m_[x, y, 0];
                    GridF_m[x, y, 1] = GridF_m_[x, y, 1];
                    GridF_m[x, y, 2] = GridF_m_[x, y, 2];
                }
            }
        }
예제 #3
0
        // конструктор - инициализация класса с созданием изображения с заданными характеристиками
        public YCrCb(int len, int width_, int height_, int widthR_, YCrCbPoint baseColor_)
        {
            baseColor = baseColor_;
            width     = width_;
            widthR    = widthR_;
            height    = height_;
            GridX     = width_ / 32 + 1;
            GridY     = height_ / 32 + 1;

            bytes  = len * 3;
            chanel = len;

            R = new byte[chanel];
            G = new byte[chanel];
            B = new byte[chanel];

            Y  = new byte[chanel];
            Cr = new byte[chanel];
            Cb = new byte[chanel];

            for (int i = 0; i < (chanel - 1); i++)
            {
                if (baseColor != null)
                {
                    Y[i]  = baseColor.Y;
                    Cr[i] = baseColor.Cr;
                    Cb[i] = baseColor.Cb;
                }
                else
                {
                    Y[i]  = 0;
                    Cr[i] = 128;
                    Cb[i] = 128;
                }
            }

            GridFY  = new double[GridX, GridY];
            GridFCr = new double[GridX, GridY];
            GridFCb = new double[GridX, GridY];
            GridF_m = new int[GridX, GridY, 3];
        }