PixelSquare.TesseractOCR.TesseractOCRBridge.SetImageData C# (CSharp) Method

SetImageData() private method

private SetImageData ( IntPtr tesseractHandle, Array imageData, int width, int height, int bytesPerPixel, int bytesPerLine ) : void
tesseractHandle IntPtr
imageData Array
width int
height int
bytesPerPixel int
bytesPerLine int
return void
        public static extern void SetImageData(IntPtr tesseractHandle, byte[] imageData, int width, int height, int bytesPerPixel, int bytesPerLine);

Usage Example

示例#1
0
        /// <summary>
        /// Sets the image to be used
        /// </summary>
        /// <param name="imageData">Image data buffer</param>
        /// <param name="width">Image Width</param>
        /// <param name="height">Image Height</param>
        public void SetImage(byte[] imageData, int width, int height)
        {
            Debug.Assert(m_Handle != IntPtr.Zero, "Handle must not be nulled!");

            if(m_Handle != IntPtr.Zero)
            {
                Color32[] colorBuffer = TesseractOCRUtility.ImageFlipVertical(imageData, width, height);
                imageData = TesseractOCRUtility.Color32ToBytes(colorBuffer);
                TesseractOCRBridge.SetImageData(m_Handle, imageData, width, height, BYTES_PER_PIXEL, BYTES_PER_PIXEL * width);
            }
        }