Пример #1
0
        public void TestArrays()
        {
            string imgfn = "test-c3.png";

            // load Bytearray
            Bytearray ba = new Bytearray(1, 1);

            ImgIo.read_image_gray(ba, imgfn);
            OcrRoutine.Invert(ba);
            //NarrayUtil.Sub((byte)255, image);
            byte[] bytes1 = ba.To1DArray();
            NarrayShow.ShowConsole(ba);
            StdInput linput1 = new StdInput(ba);

            Console.WriteLine();

            // load StdInput
            Bitmap   bitmap  = ImgIo.LoadBitmapFromFile(imgfn);
            StdInput linput2 = StdInput.FromBitmap(bitmap);
            //NarrayShow.ShowConsole(linput2);

            // test convert
            Floatarray fa      = linput2.ToFloatarray();
            StdInput   linput3 = new StdInput(fa);

            Console.WriteLine("Arrays is identical? {0}", Equals(linput1.GetDataBuffer(), linput2.GetDataBuffer()));
            Console.WriteLine("Arrays is identical? {0}", Equals(linput2.GetDataBuffer(), linput3.GetDataBuffer()));
        }
Пример #2
0
        public void TestArrays()
        {
            string imgfn = "test-c3.png";

            // load Bytearray
            Bytearray ba = new Bytearray(1, 1);
            ImgIo.read_image_gray(ba, imgfn);
            OcrRoutine.Invert(ba);
            //NarrayUtil.Sub((byte)255, image);
            byte[] bytes1 = ba.To1DArray();
            NarrayShow.ShowConsole(ba);
            StdInput linput1 = new StdInput(ba);
            Console.WriteLine();

            // load StdInput
            Bitmap bitmap = ImgIo.LoadBitmapFromFile(imgfn);
            StdInput linput2 = StdInput.FromBitmap(bitmap);
            //NarrayShow.ShowConsole(linput2);

            // test convert
            Floatarray fa = linput2.ToFloatarray();
            StdInput linput3 = new StdInput(fa);

            Console.WriteLine("Arrays is identical? {0}", Equals(linput1.GetDataBuffer(), linput2.GetDataBuffer()));
            Console.WriteLine("Arrays is identical? {0}", Equals(linput2.GetDataBuffer(), linput3.GetDataBuffer()));
        }