{"id":15998209,"url":"https://github.com/yushulx/capture-vision-maui","last_synced_at":"2025-10-21T05:30:26.776Z","repository":{"id":175808661,"uuid":"654501629","full_name":"yushulx/Capture-Vision-Maui","owner":"yushulx","description":null,"archived":true,"fork":false,"pushed_at":"2024-10-10T07:36:04.000Z","size":294,"stargazers_count":19,"open_issues_count":5,"forks_count":3,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-11-24T17:32:56.926Z","etag":null,"topics":["barcode","datamatrix","dotnet","library","maui","pdf417","qrcode"],"latest_commit_sha":null,"homepage":"https://www.nuget.org/packages/Capture.Vision.Maui","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/yushulx.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2023-06-16T09:09:28.000Z","updated_at":"2024-10-15T06:33:33.000Z","dependencies_parsed_at":null,"dependency_job_id":"ada6af13-5c0d-48f3-87ba-1ad3c28dad80","html_url":"https://github.com/yushulx/Capture-Vision-Maui","commit_stats":null,"previous_names":["yushulx/capture-vision-maui"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yushulx%2FCapture-Vision-Maui","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yushulx%2FCapture-Vision-Maui/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yushulx%2FCapture-Vision-Maui/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yushulx%2FCapture-Vision-Maui/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yushulx","download_url":"https://codeload.github.com/yushulx/Capture-Vision-Maui/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":237436593,"owners_count":19309943,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["barcode","datamatrix","dotnet","library","maui","pdf417","qrcode"],"created_at":"2024-10-08T08:08:04.981Z","updated_at":"2025-10-21T05:30:26.406Z","avatar_url":"https://github.com/yushulx.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# .NET MAUI Camera View with Dynamsoft Vision SDKs\nThis project helps developers create .NET MAUI applications featuring a custom camera view using [Dynamsoft Vision SDKs](https://www.dynamsoft.com/). These SDKs provide capabilities for barcode, MRZ (Machine Readable Zone), and document detection.\n\n## Example\n[https://github.com/yushulx/Capture-Vision-Maui/tree/main/Capture.Vision.Maui.Example](https://github.com/yushulx/Capture-Vision-Maui/tree/main/Capture.Vision.Maui.Example)\n\n- Windows\n\n    ![.NET MAUI Windows QR code scanner](https://camo.githubusercontent.com/ae08b9a3805d127862780ccfc20a695c0c9f9c69719c92a285c06c9e10173d37/68747470733a2f2f7777772e64796e616d736f66742e636f6d2f636f6465706f6f6c2f696d672f323032332f30362f646f746e65742d6d6175692d77696e646f77732d71722d636f64652d7363616e6e65722e706e67)\n\n- iOS\n    \n    ![.NET MAUI iOS: detect barcode, document and mrz](https://camo.githubusercontent.com/c05b55c16a669c49d18eb2f7e8e0a7f45814ee230e4520a01d897cb275e1d109/68747470733a2f2f7777772e64796e616d736f66742e636f6d2f636f6465706f6f6c2f696d672f323032342f30332f646f746e65742d6d6175692d696f732d626172636f64652d646f63756d656e742d6d727a2e706e67)\n\n## Demo Video: .NET MAUI QR Code Scanner\n\n- Windows\n\n  [https://github.com/yushulx/Capture-Vision-Maui/assets/2202306/df6ce0d1-93b8-4e26-be6a-cfe82ba3d267](https://github.com/yushulx/Capture-Vision-Maui/assets/2202306/df6ce0d1-93b8-4e26-be6a-cfe82ba3d267)\n\n- Android\n\n  [https://github.com/yushulx/Capture-Vision-Maui/assets/2202306/73551440-6720-4912-8605-cee9882bbee2](https://github.com/yushulx/Capture-Vision-Maui/assets/2202306/73551440-6720-4912-8605-cee9882bbee2)\n\n\n\n## Supported Platforms\n- Android\n- iOS\n- Windows\n\n## Features\n- Scan 1D barcodes, QR codes, PDF417, DataMatrix, and other barcode formats.\n- Recognize Machine Readable Zones (MRZ) from camera frames.\n- Detect document edges in real-time.\n\n## Getting Started\n1. Enable the camera view in `MauiProgram.cs`:\n\n    ```csharp\n    builder.UseNativeCameraView()\n    ```\n\n2. Request a [free trial license](https://www.dynamsoft.com/customer/license/trialLicense/?product=dcv\u0026package=cross-platform) and replace `LICENSE-KEY` with your own license key in the platform-specific code.\n    \n    **App.xaml.cs for Windows:**\n\n    ```csharp\n    using Dynamsoft;\n    using Microsoft.UI.Xaml;\n    namespace Capture.Vision.Maui.Example.WinUI\n    {\n        public partial class App : MauiWinUIApplication\n        {\n            public App()\n            {\n                this.InitializeComponent();\n                BarcodeQRCodeReader.InitLicense(\"LICENSE-KEY\");\n                DocumentScanner.InitLicense(\"LICENSE-KEY\");\n                MrzScanner.InitLicense(\"LICENSE-KEY\");\n            }\n        }\n    }\n    ```\n\n    **MainActivity.cs for Android:**\n\n    ```csharp\n    using Android.App;\n    using Android.Content.PM;\n    using Android.OS;\n    using Dynamsoft;\n    \n    namespace Capture.Vision.Maui.Example\n    {\n        public class MainActivity : MauiAppCompatActivity\n        {\n            protected override void OnCreate(Bundle savedInstanceState)\n            {\n                base.OnCreate(savedInstanceState);\n    \n                // Your platform-specific code here\n                BarcodeQRCodeReader.InitLicense(\"LICENSE-KEY\");\n                DocumentScanner.InitLicense(\"LICENSE-KEY\");\n                MrzScanner.InitLicense(\"LICENSE-KEY\");\n            }\n        }\n    }\n    ```\n\n    **Program.cs for iOS:**\n\n    ```csharp\n    using ObjCRuntime;\n    using UIKit;\n    using Dynamsoft;\n\n    static void Main(string[] args)\n    {\n        DocumentScanner.InitLicense(\"LICENSE-KEY\");\n        BarcodeQRCodeReader.InitLicense(\"LICENSE-KEY\");\n        MrzScanner.InitLicense(\"LICENSE-KEY\");\n    \n        UIApplication.Main(args, null, typeof(AppDelegate));\n    }\n    ```\n\n3. Create a content page to add the camera view:\n\n    ```xml\n    \u003c?xml version=\"1.0\" encoding=\"utf-8\" ?\u003e\n    \u003cContentPage xmlns=\"http://schemas.microsoft.com/dotnet/2021/maui\"\n                xmlns:x=\"http://schemas.microsoft.com/winfx/2009/xaml\"\n                xmlns:skia=\"clr-namespace:SkiaSharp.Views.Maui.Controls;assembly=SkiaSharp.Views.Maui.Controls\"\n                xmlns:cv=\"clr-namespace:Capture.Vision.Maui;assembly=Capture.Vision.Maui\"\n                x:Class=\"Capture.Vision.Maui.Example.CameraPage\"\n                Title=\"CameraPage\"\u003e\n        \u003cScrollView\u003e\n            \u003cGrid\u003e\n                \u003ccv:CameraView x:Name=\"cameraView\" HorizontalOptions=\"FillAndExpand\"\n                VerticalOptions=\"FillAndExpand\" EnableBarcode=\"True\" EnableDocumentDetect=\"True\" EnableMrz=\"True\"\n                                    ResultReady=\"cameraView_ResultReady\" FrameReady=\"cameraView_FrameReady\"\n                                /\u003e\n                \u003cskia:SKCanvasView x:Name=\"canvasView\" \n                            Margin=\"0\"\n                            HorizontalOptions=\"FillAndExpand\" VerticalOptions=\"FillAndExpand\"\n                            PaintSurface=\"OnCanvasViewPaintSurface\" /\u003e\n            \u003c/Grid\u003e\n        \u003c/ScrollView\u003e\n    \u003c/ContentPage\u003e\n    ```\n\n    Set `EnableBarcode`, `EnableDocumentDetect`, and `EnableMrz` to activate barcode, document, and MRZ (Machine Readable Zone) detection, respectively. Use the `cameraView_ResultReady` event to retrieve the results.\n\n    ```csharp\n    private void cameraView_ResultReady(object sender, ResultReadyEventArgs e)\n    {\n        if (e.Result is BarcodeResult[])\n        {}\n        else if (e.Result is DocumentResult)\n        {}\n        else if (e.Result is MrzResult)\n        {}    \n    }\n    ```\n\n## Custom Image Processing\nIn the `cameraView_FrameReady` event, access the camera frame for custom image processing:\n\n```csharp\nprivate void cameraView_FrameReady(object sender, FrameReadyEventArgs e)\n{\n    // process image\n}\n```\n\nThe `FrameReadyEventArgs` provide the image buffer, width, height, stride and format.\n\n```csharp\npublic class FrameReadyEventArgs : EventArgs\n{ \n    public enum PixelFormat\n    {\n        GRAYSCALE,\n        RGB888,\n        BGR888,\n        RGBA8888,\n        BGRA8888,\n    }\n    public FrameReadyEventArgs(byte[] buffer, int width, int height, int stride, PixelFormat pixelFormat)\n    {\n        Buffer = buffer;\n        Width = width;\n        Height = height;\n        Stride = stride;\n        Format = pixelFormat;\n    }\n\n    public byte[] Buffer { get; private set; }\n    public int Width { get; private set; }\n    public int Height { get; private set; }\n    public int Stride { get; private set; }\n    public PixelFormat Format { get; private set; }\n}\n```\n\nCurrently, frames captured from Windows and Android devices are in the `GRAYSCALE` format, whereas frames from iOS devices use the `BGRA8888` format.\n\n\n## Barcode Parameters Configuration\nCustomize barcode detection parameters to fit specific requirements, such as supported barcode formats and expected counts:\n    \n```csharp\npublic CameraPage()\n{\n    InitializeComponent();\n    ...\n    // cameraView.BarcodeParameters = \"{\\\"Version\\\":\\\"3.0\\\", \\\"ImageParameter\\\":{\\\"Name\\\":\\\"IP1\\\", \\\"BarcodeFormatIds\\\":[\\\"BF_QR_CODE\\\", \\\"BF_ONED\\\"], \\\"ExpectedBarcodesCount\\\":20}}\";\n}\n```\n\n## References\n- Camera: [https://github.com/hjam40/Camera.MAUI](https://github.com/hjam40/Camera.MAUI)\n- Barcode: [https://github.com/yushulx/dotnet-barcode-qr-code-sdk](https://github.com/yushulx/dotnet-barcode-qr-code-sdk)\n- Capture Vision: [https://github.com/yushulx/Capture-Vision](https://github.com/yushulx/Capture-Vision)\n\n\n## Building NuGet Package from Source Code\n\n```bash\ncd Capture.Vision.Maui\ndotnet build --configuration Release\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyushulx%2Fcapture-vision-maui","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyushulx%2Fcapture-vision-maui","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyushulx%2Fcapture-vision-maui/lists"}