{"id":34764759,"url":"https://github.com/westracer/flutter_native_opencv","last_synced_at":"2026-03-13T20:36:45.127Z","repository":{"id":37693237,"uuid":"248226609","full_name":"westracer/flutter_native_opencv","owner":"westracer","description":"Using OpenCV natively in C++ in a Flutter app with Dart FFI","archived":false,"fork":false,"pushed_at":"2021-12-16T09:11:14.000Z","size":216,"stargazers_count":218,"open_issues_count":6,"forks_count":37,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-12-26T18:53:33.354Z","etag":null,"topics":["android-ndk","c","dart-ffi","flutter","opencv-android"],"latest_commit_sha":null,"homepage":"https://medium.com/flutter-community/integrating-c-library-in-a-flutter-app-using-dart-ffi-38a15e16bc14","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/westracer.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-03-18T12:33:08.000Z","updated_at":"2025-12-17T18:53:18.000Z","dependencies_parsed_at":"2022-09-13T05:03:07.381Z","dependency_job_id":null,"html_url":"https://github.com/westracer/flutter_native_opencv","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/westracer/flutter_native_opencv","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/westracer%2Fflutter_native_opencv","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/westracer%2Fflutter_native_opencv/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/westracer%2Fflutter_native_opencv/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/westracer%2Fflutter_native_opencv/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/westracer","download_url":"https://codeload.github.com/westracer/flutter_native_opencv/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/westracer%2Fflutter_native_opencv/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30474935,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-13T17:15:31.527Z","status":"ssl_error","status_checked_at":"2026-03-13T17:15:22.394Z","response_time":60,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["android-ndk","c","dart-ffi","flutter","opencv-android"],"created_at":"2025-12-25T07:05:05.173Z","updated_at":"2026-03-13T20:36:45.105Z","avatar_url":"https://github.com/westracer.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# flutter_native_opencv\nUsing OpenCV natively in C++ in a Flutter app with Dart FFI. Tested with Flutter 2.5.2.\n\nRead the full articles:\n\n- Mobile platorms: https://medium.com/flutter-community/integrating-c-library-in-a-flutter-app-using-dart-ffi-38a15e16bc14\n- Desktop platorms: https://medium.com/flutter-community/integrating-c-library-in-a-desktop-flutter-app-using-dart-ffi-32560cb1169b\n\n# How to build \u0026 run\n\n## Android and iOS\n\nRun `init.sh` script from a `scripts` folder or do the following steps manually:\n\n1. Download OpenCV for Android and iOS: https://opencv.org/releases/\n2. Copy or create symlinks:\n   - `opencv2.framework` to `native_opencv/ios`\n   - `OpenCV-android-sdk/sdk/native/jni/include` to `native_opencv`\n   - Contents of `OpenCV-android-sdk/sdk/native/libs/**` to `native_opencv/android/src/main/jniLibs/**`\n\n## Windows\n\nRun `init_windows.ps1` PowerShell script from a `scripts` folder or do the following steps manually:\n\n1. Download OpenCV for Windows: https://opencv.org/releases/\n2. Unpack it. Set env. variable `OpenCV_DIR` to unpacked `...\\opencv\\build` folder\n3. Create a hard link from `native_opencv\\ios\\Classes\\native_opencv.cpp` to `native_opencv_windows\\windows\\native_opencv.cpp`\n4. Make sure `native_opencv_windows\\windows\\CMakeLists.txt` contains correct .dll names (OpenCV_DEBUG_DLL_NAME,OpenCV_RELEASE_DLL_NAME)\n\n## macOS\n\nBefore doing anything else, you need to download OpenCV source code and \nbuild a framework by running `opencv/platforms/apple/build_xcframework.py` script.\n\nRun `init_macos.sh` script from a `scripts` folder or do the following steps manually:\n\n1. Create a hard link from `native_opencv/ios/Classes/native_opencv.cpp` to `native_opencv_macos/macos/Classes/native_opencv.cpp`\n2. Copy `opencv2.xcframework` to `native_opencv/macos`\n\n## Linux\n\nBefore doing anything else, you need to download OpenCV source code and\nbuild libraries by following [the official tutorial](https://docs.opencv.org/master/d7/d9f/tutorial_linux_install.html).\n\nAfter making a build, set up an environmental variable `OpenCV_DIR` to the build's folder.\n\nRun `init_linux.sh` script from a `scripts` folder or do the following steps manually:\n\n1. Create a hard link from `native_opencv/ios/Classes/native_opencv.cpp` to `native_opencv_linux/linux/native_opencv.cpp`\n\n# Troubleshooting\n\n```\n  /snap/flutter/current/usr/include/x86_64-linux-gnu/gnu/stubs.h:7:11: fatal error: 'gnu/stubs-32.h' file not found\n  # include \u003cgnu/stubs-32.h\u003e\n            ^~~~~~~~~~~~~~~~\n  1 error generated.\n  ninja: build stopped: subcommand failed.\n```\nor\n```\n/snap/flutter/current/usr/bin/ld: warning: /usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu/crt1.o: unsupported GNU_PROPERTY_TYPE (5) type: 0xc0008002\nclang: error: linker command failed with exit code 1 (use -v to see invocation)\nException: Build process failed\n```\n\nInstall flutter manually instead of from snap, see: https://flutter.dev/docs/get-started/install/linux#install-flutter-manually","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwestracer%2Fflutter_native_opencv","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwestracer%2Fflutter_native_opencv","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwestracer%2Fflutter_native_opencv/lists"}