- PureBasic 99.1%
- Zig 0.9%
| .github | chore(deps): update jetify-com/devbox-install-action action to v0.12.0 ( #55 ) | |
| examples | Set names on the opencv build steps for better output while running | |
| logo | fix img name | |
| src | Add missing ColorConversionCode struct to public interface | |
| test | Update to Zig 0.14.0 and OpenCV 4.11.0 | |
| .gitignore | Update to Zig 0.14.0 and OpenCV 4.11.0 | |
| .zigversion | Update to Zig 0.14.0 and OpenCV 4.11.0 | |
| build.zig | Set names on the opencv build steps for better output while running | |
| build.zig.zon | Update to Zig 0.14.0 and OpenCV 4.11.0 | |
| LICENSE | init | |
| README.md | Add todo | |
ZigCV
The ZigCV library provides Zig language bindings for the OpenCV 4 computer vision library.
The ZigCV library supports the same nominated version of zig as Mach and the zig-gamedev libraries.
The ZigCV library currently supports OpenCV v4.11.0.
It uses GoCV 0.40.0 for its C bindings to OpenCV.
Caution
Under development. The Zig APIs may be missing or change.
Install
Add to your project's dependencies:
zig fetch --save 'git+https://codeberg.org/glitchcake/zigcv'
Add to your build.zig:
constzigcv=b.dependency("zigcv",.{});exe.root_module.addImport("zigcv",zigcv.module("root"));exe.linkLibrary(zigcv.artifact("zigcv"));Usage
Once added to your project, you may import and use.
constcv=@import("zigcv");You can also call C bindings directly via the c struct on the import.
cv.cExample
Here is a minimal program:
conststd=@import("std");constcv=@import("zigcv");pubfnmain()!void{std.debug.print("version via zig binding:\t{s}\n",.{cv.openCVVersion()});std.debug.print("version via c api directly:\t{s}\n",.{cv.c.openCVVersion()});}More Examples
There are a handful of sample programs in the examples/ directory.
You can build them by running zig build there:
cd examples && zig build; popd; ./examples/zig-out/bin/hello
Demo
./examples/zig-out/bin/face_detection 0
Technical restrictions
Due to zig being a relatively new language it does not have full C ABI support at the moment. For use that mainly means we can't use any functions that return structs that are less than 16 bytes large on x86, and passing structs to any functions may cause memory error on arm.
Todo
- Get all examples working
- Fix all commented out tests
- Add cuda and openvino back
License
MIT
Authors
Ryotaro "Justin" Kimura (a.k.a. ryoppippi)