public async Task <string> GetText(InputImage inputImage) { ImageProperties imgPropOut = new ImageProperties(); imgPropOut.outAllocatedSize = inputImage.pitchBytes * inputImage.height; IOpenCVComputeAPI.GetOutBuf(OpenCVComputeAPIhandle.handle, inputImage.imageBuf, imgPropOut.outAllocatedSize, ref imgPropOut.outRealSize, ref imgPropOut.compressionType, ref imgPropOut.subCompressionType, ref imgPropOut.width, ref imgPropOut.height, ref imgPropOut.bitDepth); IntPtr pString = ITessApiSignatures.APIRect(handle, inputImage.imageBuf, inputImage.bytesPerPixel, inputImage.pitchBytes, 0, 0, inputImage.width, inputImage.height); var strRes = Marshal.PtrToStringAnsi(pString); //var b = new SharpDX.DXGI.Surface(); //var a = new SharpDX.Direct2D1.RenderTarget(,,); //GetBoxes(inputImage); // SkiaSharp.SKRectI rect = new SKRectI(0,0,100,100); return(strRes); }
public async Task <ImageProperties> GetImageProperties(ImageProperties imgProp) { OpenCVComputeAPIhandle.handle = IOpenCVComputeAPI.CreateOCVCInstance(); ImageProperties imgPropOut = imgProp; imgPropOut.outAllocatedSize = ImageProperties.maxSize; safeBuf interBuf = new safeBuf(); interBuf.buf = new byte[imgPropOut.outAllocatedSize]; interBuf.gchandle = GCHandle.Alloc(interBuf.buf, GCHandleType.Pinned); interBuf.pBuf = interBuf.gchandle.AddrOfPinnedObject(); imgPropOut.outBuf.buf = new byte[imgPropOut.outAllocatedSize]; imgPropOut.outBuf.gchandle = GCHandle.Alloc(imgPropOut.outBuf.buf, GCHandleType.Pinned); imgPropOut.outBuf.pBuf = imgPropOut.outBuf.gchandle.AddrOfPinnedObject(); IOpenCVComputeAPI.DecompressImage(OpenCVComputeAPIhandle.handle, imgPropOut.inBuf, imgPropOut.inSize, interBuf.pBuf, imgPropOut.outAllocatedSize, ref imgPropOut.outRealSize, ref imgPropOut.compressionType, ref imgPropOut.subCompressionType, ref imgPropOut.width, ref imgPropOut.height, ref imgPropOut.bitDepth); IOpenCVComputeAPI.PostProc(OpenCVComputeAPIhandle.handle, imgPropOut.outBuf.pBuf, imgPropOut.outAllocatedSize, ref imgPropOut.outRealSize, ref imgPropOut.compressionType, ref imgPropOut.subCompressionType, ref imgPropOut.width, ref imgPropOut.height, ref imgPropOut.bitDepth); return(imgPropOut); }