The ZIGCV library provides Zig language bindings for the OpenCV 4 computer vision library.
This fork of the zigcv library supports the nominated version of zig and OpenCV (v4.6.0) on Linux and OSX. This fork does NOT have support for Windows yet due to Froxcey not having access to a Windows machine. Contribution to add Windows support is welcome, but Froxcey does not have any plan to add it himself.
Still under development, so the zig APIs will be dynamically changed.
You can use const c_api = @import("zigcv").c_api;
to call c bindings directly.
This C-API is currently fixed.
- Install additional build dependencies (required on Linux)
# Ubuntu/Debian
apt install cmake python3-numpy libc++-15-dev libc++abi-15-dev pkg-config libopencv-dev libavcodec-dev libavformat-dev libavutil-dev libswscale-dev
# macOS (optional)
brew install cmake pkg-config ffmpeg openvino gstreamer
- Run this following to fetch this zig package:
zig fetch --save git+https://github.com/zig-nominated-compat/zigcv.git
- Add this to your build.zig:
const zigcv = @import("zigcv");
const zigcv_dep = b.dependency("zigcv", .{});
if (zigcv.make_step != null) exe.step.dependOn(&zigcv.make_step.?);
exe.root_module.addImport("zigcv", zigcv_dep.module("zigcv"));
you can build some demos. For example:
zig build examples
Or you can build a bundled version
zig build -Dbundle examples
Or you can run the demo with the following command:
You can see the full demo list by zig build --help
.
Zigcv requires bundling on Linux, more details here.
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.
MIT
Ryotaro "Justin" Kimura (a.k.a. ryoppippi)
Froxcey