Exemple #1
0
        public GrayscaleByteImage ToBinaryImage(byte koef = 127)
        {
            GrayscaleByteImage res = new GrayscaleByteImage(Width, Height);

            for (int i = 0; i < rawdata.Length; i++)
            {
                res.rawdata[i] = rawdata[i] < koef ? (byte)0 : (byte)255;
            }
            return(res);
        }
Exemple #2
0
        public GrayscaleByteImage ToGrayscaleByteImage()
        {
            GrayscaleByteImage res = new GrayscaleByteImage(Width, Height);

            for (int i = 0; i < res.rawdata.Length; i++)
            {
                res.rawdata[i] = rawdata[i] < 0.0f ? (byte)0 : rawdata[i] > 255.0f ? (byte)255 : (byte)rawdata[i];
            }
            return(res);
        }