Exemplo n.º 1
0
        public String LinearizeImageToString(NormalizeTo32x32Type normalizeTo32x32OperationType)
        {
            if (!normalizedTo32x32)
            {
                NormalizeTo32x32(normalizeTo32x32OperationType);
            }
            if (!madeOnlyBlackAndWhite)
            {
                MakeOnlyBlackAndWhite();
            }
            String ret = "";

            for (int i = 0; i < m_bitmap.Height; i++)
            {
                for (int j = 0; j < m_bitmap.Width; j++)
                {
                    Color currentColor = m_bitmap.GetPixel(j, i);
                    if (currentColor.R == 255) // white
                    {
                        ret += "1";
                    }
                    else // black
                    {
                        ret += "0";
                    }
                }
            }
            return(ret);
        }
Exemplo n.º 2
0
        public void NormalizeTo32x32(NormalizeTo32x32Type opType)
        {
            Bitmap resizedBitmap = null;

            switch (opType)
            {
            case NormalizeTo32x32Type.BiasedRatio:
                resizedBitmap     = new Bitmap(m_bitmap, new Size(32, 32));
                m_bitmap          = resizedBitmap;
                normalizedTo32x32 = true;
                break;

            case NormalizeTo32x32Type.UnbiasedRatio:
                AddWhiteLinesOrColumns();
                resizedBitmap     = new Bitmap(m_bitmap, new Size(32, 32));
                m_bitmap          = resizedBitmap;
                normalizedTo32x32 = true;
                break;
            }
        }