PaddleSharp icon indicating copy to clipboard operation
PaddleSharp copied to clipboard

Can this code example run on xamarin android

Open smetronic opened this issue 1 year ago • 2 comments

Hi,

i want to know if the below example will work on Xamarin android

Windows(Local model): Detection and Recognition(All) Install NuGet Packages:

Sdcb.PaddleInference Sdcb.PaddleOCR Sdcb.PaddleOCR.Models.Local Sdcb.PaddleInference.runtime.win64.mkl OpenCvSharp4.runtime.win Using following C# code to get result:

FullOcrModel model = LocalFullModels.ChineseV3;

byte[] sampleImageData; string sampleImageUrl = @"https://www.tp-link.com.cn/content/images2017/gallery/4288_1920.jpg"; using (HttpClient http = new HttpClient()) { Console.WriteLine("Download sample image from: " + sampleImageUrl); sampleImageData = await http.GetByteArrayAsync(sampleImageUrl); }

using (PaddleOcrAll all = new PaddleOcrAll(model, PaddleDevice.Mkldnn()) { AllowRotateDetection = true, /* 允许识别有角度的文字 / Enable180Classification = false, / 允许识别旋转角度大于90度的文字 */ }) { // Load local file by following code: // using (Mat src2 = Cv2.ImRead(@"C:\test.jpg")) using (Mat src = Cv2.ImDecode(sampleImageData, ImreadModes.Color)) { PaddleOcrResult result = all.Run(src); Console.WriteLine("Detected all texts: \n" + result.Text); foreach (PaddleOcrResultRegion region in result.Regions) { Console.WriteLine($"Text: {region.Text}, Score: {region.Score}, RectCenter: {region.Rect.Center}, RectSize: {region.Rect.Size}, Angle: {region.Rect.Angle}"); } } }

smetronic avatar Sep 22 '23 12:09 smetronic

it will not work, because I didn't compile android arm64's paddle_inference_c library.

sdcb avatar Oct 10 '23 09:10 sdcb

@sdcb Is there anyplan for xamarin.forms? It would be great if we could use it in the mobile platforms

ertan2002 avatar May 15 '24 07:05 ertan2002